# Process Schedule List - AttributeError: 'List\[object\]' object has no attribute 'ViewType'

**URL:** <https://forum.dynamobim.com/t/process-schedule-list-attributeerror-list-object-object-has-no-attribute-viewtype/75679>\
**Category:** Revit\
**Tags:** python, dynamo\
**Created:** [April 21, 2022, 7:42am UTC](https://forum.dynamobim.com/t/process-schedule-list-attributeerror-list-object-object-has-no-attribute-viewtype/75679 "2022-04-21T07:42:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bladen](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Bladen](https://forum.dynamobim.com/u/Bladen)\
**Post date:** [April 21, 2022, 7:42am UTC](https://forum.dynamobim.com/t/process-schedule-list-attributeerror-list-object-object-has-no-attribute-viewtype/75679/1 "2022-04-21T07:42:52Z")

</div>

Hi all, I have been recently learning python but cant seem to figure out why this code wont work, i found this code for adding the “HasParameter” Filter onto my schedules which works if you feed the script a direct view but if its a list of views, it throws this error

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.  
Traceback (most recent call last):  
File “”, line 22, in   
AttributeError: ‘List[object]’ object has no attribute ‘ViewType’

Thank you for any help, and a explaination would also be helpful! 😃

Code Below:

```auto
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

def fieldId(schDefinition, fieldName):
	OrderedFields = schDefinition.GetFieldOrder()
	for x,id in enumerate(OrderedFields):
		field = schDefinition.GetField(id)
		if field.GetName() == fieldName:
			return schDefinition.GetFieldId(x)
	return None       

schedule = UnwrapElement(IN[0])

OUT = []

if schedule.ViewType == ViewType.Schedule:
	try:
		definition = schedule.Definition
		field = fieldId(definition,IN[1])		
		TransactionManager.Instance.EnsureInTransaction(doc)		
		filter = ScheduleFilter(field, ScheduleFilterType.HasParameter)
		definition.AddFilter(filter)		
		TransactionManager.Instance.TransactionTaskDone()		
		OUT.append(schedule)
	except:
		OUT.append("Check Field Name")
else:
	OUT.append("Input View is not a Schedule")

```

---

<div class="post-metadata">

**Author:** ![Elie.Trad](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/elie.trad/32/110373_2.png) [@Elie.Trad](https://forum.dynamobim.com/u/Elie.Trad)\
**Post date:** [April 21, 2022, 8:31am UTC](https://forum.dynamobim.com/t/process-schedule-list-attributeerror-list-object-object-has-no-attribute-viewtype/75679/2 "2022-04-21T08:31:56Z")

</div>

@Bladen when dealing with more than one item, in your case a list of items, you need a for loop to make it work, check in the forum for it, there are plenty of examples

---

<div class="post-metadata">

**Author:** ![Bladen](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Bladen](https://forum.dynamobim.com/u/Bladen)\
**Post date:** [April 21, 2022, 8:48am UTC](https://forum.dynamobim.com/t/process-schedule-list-attributeerror-list-object-object-has-no-attribute-viewtype/75679/3 "2022-04-21T08:48:27Z")

</div>

ah okay, i assumed the for loop already in the code would of done this, thank you for the reply and infomation.
