# Elements from rows in schedule

**URL:** <https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141>\
**Category:** Revit\
**Tags:** schedule\
**Created:** [July 13, 2021, 1:52pm UTC](https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141 "2021-07-13T13:52:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Jirat](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@Peter\_Jirat](https://forum.dynamobim.com/u/Peter_Jirat)\
**Post date:** [July 13, 2021, 1:52pm UTC](https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141/1 "2021-07-13T13:52:34Z")

</div>

Hi all, I have a schedule in Revit (windows table somehow filtered and sorted), and I need in Dynamo to get a list of sublists, where in every sublist wilb be all elements on one row of schedule (similar to Schedule.GetDataRow, but output will be elements instead of data).  
Schedule is like this:  
 ![OK1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/9/d9fc31f816139c106e7587e24b81d7d3243a6493.png)  
Last column is Count, so first sublist will have 1 element, fifth sublist will have 48 elements etc.  
Thanks for help

---

<div class="post-metadata">

**Author:** ![AmolShah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amolshah/32/103244_2.png) [@AmolShah](https://forum.dynamobim.com/u/AmolShah)\
**Post date:** [July 14, 2021, 4:47am UTC](https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141/2 "2021-07-14T04:47:56Z")

</div>

Hi @Peter_Jirat,  
Welcome to the Dynamo community.

You can do something like this with Python: [GetSorted GroupedScheduleElements.dyn](https://forum.dynamobim.com/uploads/short-url/eJz8wc1YX1ebP0jAaGDx0NcABXa.dyn) (29.8 KB)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/0/e01184fd5e21b48c34b8e5f34b8d3e1e5fa2e232.png)

```auto
import clr
clr.AddReference("RevitAPI","RevitServices")
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

scheduleView = UnwrapElement(IN[0])
scheduleDefinition = scheduleView.Definition
scheduleParameters = ScheduleDefinition.GetSortGroupFields(scheduleDefinition)
elements = FilteredElementCollector(doc,scheduleView.Id).ToElements()

paraVals = []

for scheduleParameter in scheduleParameters:
	parameter = scheduleDefinition.GetField(scheduleParameter.FieldId).GetName()
	temp = []
	for element in elements:
		instParaVal = element.LookupParameter(parameter)
		if instParaVal:
			temp.append(instParaVal.AsString())
		else:
			temp.append(doc.GetElement(element.GetTypeId()).LookupParameter(parameter).AsString())
	paraVals.append(temp)

keys = ['|'.join(z) for z in zip(*paraVals)]
sortedKeys = sorted(set(keys))

OUT = [[elekey[0] for elekey in zip(elements,keys) if elekey[1]==key] for key in sortedKeys]

```

---

<div class="post-metadata">

**Author:** ![AmolShah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amolshah/32/103244_2.png) [@AmolShah](https://forum.dynamobim.com/u/AmolShah)\
**Post date:** [July 14, 2021, 4:52am UTC](https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141/3 "2021-07-14T04:52:43Z")

</div>

@Peter_Jirat If that doesn’t work out, you can install some custom packages [Data-Shapes & Rhythm] and do something as shown below. [GetSorted GroupedScheduleElements.dyn](https://forum.dynamobim.com/uploads/short-url/eJz8wc1YX1ebP0jAaGDx0NcABXa.dyn) (29.8 KB)

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/c/5c0b738b722524e18b87bc1b2262f09f06cb163e.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Jirat](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@Peter\_Jirat](https://forum.dynamobim.com/u/Peter_Jirat)\
**Post date:** [July 14, 2021, 7:42am UTC](https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141/4 "2021-07-14T07:42:22Z")

</div>

Hi @AmolShah , thanks for your node solution script, works fine with small changes for more then 2 sorting parameters. Any idea how to get a list of all **sorting** parameters from a schedule?  
Python gives me some string error:

 ![OK2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/b/3bc6c7e854b49ed8b462bf07bc614c2b63157b88.png)

---

<div class="post-metadata">

**Author:** ![AmolShah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amolshah/32/103244_2.png) [@AmolShah](https://forum.dynamobim.com/u/AmolShah)\
**Post date:** [July 14, 2021, 4:18pm UTC](https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141/5 "2021-07-14T16:18:09Z")

</div>

@Peter_Jirat Ignore the Python solution. It’s a work in progress.

For the node based solution, I’ve added a python node to get all sorting parameters.  
[GetSortedGroupedScheduleElements.dyn](https://forum.dynamobim.com/uploads/short-url/lbcNaIztlbUlAs3xHnRCxhgwyyM.dyn) (22.1 KB)

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/d/ad48aba081fe017bfbd1e62af346d6d9e9b47266.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Jirat](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@Peter\_Jirat](https://forum.dynamobim.com/u/Peter_Jirat)\
**Post date:** [July 15, 2021, 2:58pm UTC](https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141/6 "2021-07-15T14:58:28Z")

</div>

Hi, this is EXACTLY what I needed. Thanks

---

<div class="post-metadata">

**Author:** ![ruben.romero](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ruben.romero/32/115842_2.png) [@ruben.romero](https://forum.dynamobim.com/u/ruben.romero)\
**Post date:** [September 11, 2021, 11:11pm UTC](https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141/7 "2021-09-11T23:11:47Z")

</div>

> [@AmolShah](#):
>
> ```auto
> parameter = scheduleDefinition.GetField(scheduleParameter.FieldId).GetName()
> 	
> 
> ```

how can I get the parameter ID and the parameter itself of the schedule fields to query it later? I want to know more about the parameters, not the elements. I think it is not far from what I see in the script

---

<div class="post-metadata">

**Author:** ![KlavaK](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@KlavaK](https://forum.dynamobim.com/u/KlavaK)\
**Post date:** [December 11, 2022, 3:01pm UTC](https://forum.dynamobim.com/t/elements-from-rows-in-schedule/66141/8 "2022-12-11T15:01:10Z")

</div>

If still relevant to someone

```auto
field = scheduleDefinition.GetField(scheduleParameter.FieldId)
parameter_id = field.ParameterId
parameters = doc.GetElement(parameter_id)

```
