# Associate family parameter in a family

**URL:** <https://forum.dynamobim.com/t/associate-family-parameter-in-a-family/19709>\
**Category:** Revit\
**Created:** [March 6, 2018, 11:40am UTC](https://forum.dynamobim.com/t/associate-family-parameter-in-a-family/19709 "2018-03-06T11:40:03Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![3Pinter](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/3pinter/32/74327_2.png) [@3Pinter](https://forum.dynamobim.com/u/3Pinter)\
**Post date:** [March 23, 2018, 7:48am UTC](https://forum.dynamobim.com/t/associate-family-parameter-in-a-family/19709/17 "2018-03-23T07:48:02Z")

</div>

oh my… your suggestion… look at the output.

the list order changes … sometimes …  
look at [0][1] which has merk, start\_lagenmaat which the script will try to pair this up with [0][2] start\_lagenmaat, Description … well, that obvious won’t work.

My yesterday’s screencast show several elements not being assigned … well, now we know why. Next step, figuring out why python changes the order of the list.  
I’m going to try a zip alternative … unsure if python libraries could cause this issue? (how to check this?)

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

Coding result parameter order … seems just fine.  
TransactionManager.Instance.EnsureInTransaction(doc)  
error\_report.append(sorted(zip(elemAssoc, famAssoc)))  
for pair in ((elemAssoc[c], famAssoc[c]) for c in xrange(min(len(elemAssoc), len(famAssoc)))):

```
		error_report.append(pair)
	#for i,j in sorted(zip(elemAssoc, famAssoc)):
	#	try:
			#doc.FamilyManager.AssociateElementParameterToFamilyParameter(pair[0], pair[1])
			#doc.FamilyManager.CanElementParameterBeAssociated(i,j)		
	# error_report.append(pair)
			
	#	except:
	# error_report.append("can't assign parameter")
	TransactionManager.Instance.TransactionTaskDone()

```

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/1/31d5da7e34d1138104de73c3c5c2593e84b524c5.png)

---

_[View the full topic](https://forum.dynamobim.com/t/associate-family-parameter-in-a-family/19709)._
