For each loop - list iteration


I am having a bit of trouble with iterating lists and hoping someone can help.

I have a list generated in excel that I want to compare to an element ID in a family. When one of the elements in the list matches, I would like to get the rest of the information from the excel row to populate other parameters. I would do this as a for each loop in VB, but I cannot get the loop feature to work no matter how hard I try. A cross-product lacing on an == node works to show which is true but I can’t get filterbyboolmask to accept the subgroups. Any ideas? Thanks for your help


try mapping filerbyboolmask over the list of sub lists, it’s a bit tough to picture the exact setup, but map is basically for each, where you do a function to every item in a list.


Thanks Michael. Could you look over and see what is wrong here? I get null values when I do cross-product.list


Hello Travis,
your problem is your list order. You are trying to mask a nested list on a regular list. In my experience, sometimes works “only with numbers”.
But maybe the [List.ContainsItem] node is the better way for your purpose:


But I’m not sure if it works with IDs.


Hi Leo,

I just got a chance to look at this again (busy week) but I should explain a little better as my example wasn’t the best reference to what I am looking to do. What I am specifically looking for is to be able to find which item per subgroup is true. I’m comparing a column in excel to an element identifier in the model so when I get a true statement I want to get the correlating information from the adjacent excel columns to fill parameters in the element. I’m looking to do each run the whole list for each element (which works cross product) but now I need the sublists true fill collect the information. Michael suggested but I cannot get it to work for me as shown in my example, I don’t have much experience with this function so I assume I have it connected incorrectly. List contain works but it doesn’t allow me to get the correct information from excel (at least that I can see).

Thanks for all of your help



You can just use a node like Id to Element (package or Element.ByID (package Clockwork) to select elements by ID and then subsequently set their parameters. It doesn’t really sound like there’s any matching necessary.


Hi Andreas,

My element ID is not a true element ID in the model, just a place marker. A better term may be a key. I’m using the element id of an element from one model that I am exporting to excel as the type name of an element in a different model. It’s not really an ideal set-up but the best way I can see to “link” these elements.


Maybe it would help if you could elaborate a little more on your setup and what you are trying to achieve.


First a disclaimer. This is not my idea, it’s a work around for a bad situation I have no control over.

So I have a model broken into many smaller models but I need callouts from one model referenced into the others. The solution we came up with is of course “fake” callouts. I do not want to have someone chase the details through many models which have the potential to get missed so I want to use Dynamo to fill out the callout heads. To accomplish this I have a head that I create types of based off of the view reference in the original model. This way if a view moves I have an identifier that I can use to track it. So the view reference id in one model is the type name of the callout in another model. I have a Dynamo script that extracts the View ID, View Name and View Number from the original model and saves it to excel. My issue is I am trying to iterate through the excel list to find the matching ID so I can gather the other information for the callout. I need each callout to scan the list and when it finds the correct number use it. If I do a cross-product lacing of the == node it gives me the matching item in a subgroup of Boolean expressions. That is where I am stalled, I cannot filter by Boolean mask to extract that number and it’s correlating values. List.Map seems viable but I am unable to get it to work.

Any help is greatly appreciated.