Hi @ste_camp , thanks for starting the new thread.
Here’s one way you could do that:
change the line :
refschedule = UnwrapElement(IN[0])
with :
if isinstance(IN[0],list):
refschedule = [UnwrapElement(i) for i in IN[0]]
else:
refschedule = [UnwrapElement(IN[0])]
then iterate through the list of refschedules: ( i took the transaction out of the loop so you don’t start a new transaction at each iteratio…)
TransactionManager.Instance.EnsureInTransaction(doc)
for r in refschedule:
refdefinition = r.Definition
reffilter = refdefinition.GetFilter(0)
tgtdefinitions = []
tgtfilters = []
a = refdefinition.GetFieldId(0)
b = reffilter.FilterType
for tgtschedule in tgtschedules:
tgtdefinition = tgtschedule.Definition
tgtdefinitions.append(tgtdefinition)
for tgtstring in tgtstrings:
tgtfilter = ScheduleFilter(a, b, tgtstring)
tgtfilters.append(tgtfilter)
for tgtdefinition, tgtfilter in zip(tgtdefinitions, tgtfilters):
tgtdefinition.SetFilter(0,tgtfilter)
TransactionManager.Instance.TransactionTaskDone()
OUT = len(tgtdefinitions)