# The elusive Schedule Key ? Where does it live?

**URL:** <https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300>\
**Category:** Packages\
**Created:** [April 9, 2015, 5:05am UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300 "2015-04-09T05:05:53Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin\_Hutton1](https://avatars.discourse-cdn.com/v4/letter/c/bb73d2/32.png) [@Colin\_Hutton1](https://forum.dynamobim.com/u/Colin_Hutton1)\
**Post date:** [April 9, 2015, 5:05am UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/1 "2015-04-09T05:05:53Z")

</div>

![ScheduleKeys](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/e/ed7109a7cdd52cd54e33037fe502314a3c5ada05.jpg)

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

Does anyone know IF I can get access to a particular System parameter and it’s associated data , the parameter is called KEY NAME and is created whenever a SCHEDULE KEY type Schedule is created…

I can’t even find this elusive System parameter on exporting the full Revit model to a Database, wondered if Dynamo Could find it ( and it’s accompanying Text , the example above would have a Key Name of F02 for example, and would therefore find Floor 2 beside it )

Thoughts?

&nbsp;

&nbsp;

Regards

&nbsp;

Colin…

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [April 9, 2015, 9:16am UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/2 "2015-04-09T09:16:27Z")

</div>

Colin,

I am not sure what you are asking for or rather what the objective here is but Key Schedule Name is not that elusive. You can easily get it by calling this method:

> yourSchedule.KeyScheduleParameterName

or you can even set it yourself if you call it like this:

> yourSchedule.KeyScheduleParameterName = someName

Now what that will get you is just a name of a parameter but at the end of the day I envision that you want to access the values inside each of the rows of your key schedule and either set a new value or read the existing value. KeyScheduleName is not needed for that and as a matter of fact i found it easier to do without it. I bet some Autodesk Revit API gurus (yeah I am thinking of Jeremy Tammik here :-) ) will disagree with me, but here is my method for getting/setting data in Key Schedule:

> #Copyright(c) 2015, Konrad Sobon # @arch\_laboratory, http://archi-lab.net
> 
> import clr  
> import sys  
> clr.AddReference(‘ProtoGeometry’)  
> from Autodesk.DesignScript.Geometry import \*
> 
> # Import DocumentManager and TransactionManager
> 
> clr.AddReference(“RevitServices”)  
> import RevitServices  
> from RevitServices.Persistence import DocumentManager  
> from RevitServices.Transactions import TransactionManager
> 
> # Import RevitAPI
> 
> clr.AddReference(“RevitAPI”)  
> import Autodesk  
> from Autodesk.Revit.DB import \*
> 
> doc = DocumentManager.Instance.CurrentDBDocument  
> uiapp = DocumentManager.Instance.CurrentUIApplication  
> app = uiapp.Application
> 
> from System.Collections.Generic import \*
> 
> # Import ToDSType(bool) extension method
> 
> clr.AddReference(“RevitNodes”)  
> import Revit  
> clr.ImportExtensions(Revit.Elements)
> 
> pyt\_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’  
> sys.path.append(pyt\_path)  
> import re
> 
> #The inputs to this node will be stored as a list in the IN variable.  
> dataEnteringNode = IN
> 
> keySchedule = UnwrapElement(IN[0])  
> data = IN[1]  
> inputParams = IN[2]  
> upper = IN[3]
> 
> # “Start” the transaction
> 
> TransactionManager.Instance.EnsureInTransaction(doc)
> 
> tableData = keySchedule.GetTableData()  
> sectionData = tableData.GetSectionData(SectionType.Body)
> 
> keyNames =   
> for i in range(1,sectionData.NumberOfRows - 1,1):  
> keyNames.append(str(int(i)))
> 
> allKeys = FilteredElementCollector(doc).WhereElementIsNotElementType()  
> params = [for i in range(len(keyNames))]
> 
> for key in allKeys:  
> try:  
> if key.get\_Parameter(BuiltInParameter.REF\_TABLE\_ELEM\_NAME).AsString() in keyNames and key.OwnerViewId == keySchedule.Id:  
> indexValue = keyNames.index(key.get\_Parameter(BuiltInParameter.REF\_TABLE\_ELEM\_NAME).AsString())  
> for i in range(0, len(inputParams),1):  
> params[indexValue].append(key.get\_Parameter(str(inputParams[i])))  
> except:  
> pass
> 
> for i, j in zip(params, data):  
> for param, value in zip(i,j):  
> if isinstance(value, str):  
> valueDecoded = value.decode(‘string\_escape’)  
> else:  
> valueDecoded = str(value).decode(‘string\_escape’)  
> if upper:  
> valueDecoded = valueDecoded.upper()  
> param.Set(valueDecoded)  
> else:  
> param.Set(valueDecoded)
> 
> # “End” the transaction
> 
> TransactionManager.Instance.TransactionTaskDone()
> 
> #Assign your output to the OUT variable  
> OUT = 0

  
Now of course this blog has impossible formatting for posting code and NO ONE SEEMS TO CARE, so now its your job to figure out indentation in this code snippet. You can thank the awesome webmaster who is managing this blog for the fact that you can’t read the code that users post for you. Please let me know if this works - if you can decode it.

Good luck!

---

<div class="post-metadata">

**Author:** ![Colin\_Hutton1](https://avatars.discourse-cdn.com/v4/letter/c/bb73d2/32.png) [@Colin\_Hutton1](https://forum.dynamobim.com/u/Colin_Hutton1)\
**Post date:** [April 10, 2015, 3:22am UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/3 "2015-04-10T03:22:06Z")

</div>

Konrad, many, many thanks for the response, that’s even before I try and ‘unravel’ your code ( with the help of Sol who I work beside…)

Cart before horse, I will explain the reason for the question I guess. I’m creating a Database ( using Revit DB Link ) for my Revit data. Now it is usually extremely good at exporting ALL parameters, system, family and shared, that way I can manipulate the data, in this case, to create Room Data Sheets. What I found was that this particular parameter ( parameter wise it seems fairly unique in Revit as far as I can tell? ) did not export, therefore what I was trying to do is establish if it could be ‘seen’ either through the API/Dynamo etc, that way I could possibly find it within the database in some sort of form.

Make sense?

Weirdly, I discovered it exports fine from a schedule to good ol’ TXT format, but for some reason it fails in Revit DB link. Therefore I have at least found a way to get the data out using one extra step in my workflow.

I have no doubt your level of frustration is through the roof with this blog and how it deals with code, THAT needs to change, it’s fundamental to this type of forum!

Once again, many thanks for the input above. You guys are what keeps Dynamo rolling

&nbsp;

Colin…

---

<div class="post-metadata">

**Author:** ![Dimitar\_Venkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dimitar_venkov/32/2068_2.png) [@Dimitar\_Venkov](https://forum.dynamobim.com/u/Dimitar_Venkov)\
**Post date:** [April 10, 2015, 4:22am UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/4 "2015-04-10T04:22:56Z")

</div>

I might be missing something, but wouldn’t this be as easy as fetching the “Floor/Room/etc. Style” parameter like below?

![2015-04-10_17-34-50](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/3/38b09d5e4bca035af6f03544188313a75fef64e9.png)

&nbsp;

Also I completely agree with Konrad. Visuals and nodes are great but only up to a point. Sometimes, if you want to get to the nitty-gritty, you have to pull up your sleeves and get cracking on some code. Wouldn’t it be nice if we could easily re-use and improve something existing and then just as easily share it back afterwards? Why force people to re-invent the wheel every time? I’m sure integrating one of the existing solutions would be no challenge at all for the web team.

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [April 10, 2015, 8:56am UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/5 "2015-04-10T08:56:15Z")

</div>

Colin,

I am sure you already know this but just to make sure that you are aware of how the Key Schedules are working “under the hood” and what you really looking at when you see them in UI.

Every line in a key schedule is a legit Revit DB element. That means that in its behavior it is very similar to what a piece of furniture might be. It’s important to understand this because this makes them much different than what data in regular schedules is. That KeyScheduleParameter name is just an identifier for you to be able to get all of those elements for a given Key Schedule. Now, like I said, each row is a unique element and for each row you have a number of columns. Each column is a parameter that you can get/set by selecting the row element and asking it for its parameters. So for example a furniture might have height/width/depth parameters and you can access them only through that furniture. Same is true of key schedule data to get values from particular fields you have to obtain the row element first then its parameter.

Now, I dont use the KeyScheduleParameter to identify what elements belong to what schedule, because i used a different method. you can select all key schedule elements (keys) and see what View owns them. That will give me a schedule id/name and i can filter for all elements belonging to a view. Then you can query each key for its parameters and that will give you all of the values for each row of data in key schedule.

There is a set of nodes for writing/creating key schedules as part of archi-lab package and if you peak under the hood of those python nodes you will see exactly how i access all of the data in key schedules.

Good luck!

---

<div class="post-metadata">

**Author:** ![James\_Hyde](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@James\_Hyde](https://forum.dynamobim.com/u/James_Hyde)\
**Post date:** [July 24, 2015, 9:57am UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/6 "2015-07-24T09:57:29Z")

</div>

I am getting an error on line 28, index error out of range: 1

![Untitled](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/2/247719f38d92f3c17117e85fdf2630f0b882eccd.jpg)

&nbsp;

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [July 27, 2015, 11:30am UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/7 "2015-07-27T11:30:21Z")

</div>

James,

Does your python node have more than one input? If not, then click the + button to add those. This error should go away if you have all inputs specified as required.

---

<div class="post-metadata">

**Author:** ![James\_Hyde](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@James\_Hyde](https://forum.dynamobim.com/u/James_Hyde)\
**Post date:** [July 30, 2015, 10:12am UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/8 "2015-07-30T10:12:51Z")

</div>

Thanks, yes sorted that - doh!

Now have problem on line 34

AttributeError: ‘Nonetype’ object has no attribute ‘GetTableData’

![Untitled](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/1/124797306add893ff4d4ea0fea1cec2ced1db793.png)

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [July 31, 2015, 4:30pm UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/9 "2015-07-31T16:30:31Z")

</div>

Now, that you added the inputs to your Python node,try feeding something into it? hint: ViewSchedule.

---

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 17, 2018, 8:56pm UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/10 "2018-09-17T20:56:45Z")

</div>

hi Konrad, i try to figure out your Python code, what is BuiltInParameter.GN? well, below captures are my adaption of your exact Python code, seems not updating to my Revit key schedule, well, i just want to find bidirectional way between Excel and Key Schedule, using OOTB nodes only including Python, thanks!  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/7/d719cc84cff88e3e7b3e9fff5e3486bba68c5d05.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/b/5b5d671ad1926c86094576238bcdd3488c191c8c.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/0/40acac7d5d519fd15c2027a00247f14833b8e844.png)

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [September 17, 2018, 9:12pm UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/11 "2018-09-17T21:12:41Z")

</div>

Hey,

I wonder if you’ve accidentally got a typo? The code above has…

if key.get\_Parameter(BuiltInParameter.REF\_TABLE\_ELEM\_NAME).AsString() in keyNames and key.OwnerViewId == [keySchedule.Id](http://keySchedule.Id):

Hope that helps,

Mark

---

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 18, 2018, 1:54pm UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/12 "2018-09-18T13:54:10Z")

</div>

thanks Mark, i updated the code, still not working, i must miss something or something wrong w/ that Python, well, not like C#, it’s difficult to troubleshoot Python

edit: works after i use original archi-lab Python

---

<div class="post-metadata">

**Author:** ![Ning\_Zhou](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ning_zhou/32/68283_2.png) [@Ning\_Zhou](https://forum.dynamobim.com/u/Ning_Zhou)\
**Post date:** [September 27, 2018, 8:54pm UTC](https://forum.dynamobim.com/t/the-elusive-schedule-key-where-does-it-live/1300/13 "2018-09-27T20:54:35Z")

</div>

somehow it doesn’t work anymore, same key schedule, same input, Revit key schedule won’t update, i even tried archilab key schedule node

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/d/ade6628d1dcae8a34595831975ab7e884c742a83.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/f/9fecd2516976cadf1a502f476cd0600403544233.png)  
i added traceback and below error message:  
AttributeError: ‘NoneType’ object has no attribute ‘AsString’  
what’s going on? is my input wrong but why it worked before? or just Friday thing!?
