Using an Excel value that occurs in multiple revit elements

dynamo

#1

I have excel rows that my matched value and other columns need to be applied to Revit elements that may repeat. I have tried to look at using cycle to get the lists to match in length, but I cannot seem to get my number of values in the excel list to be consistent with the list of elements with the matched values in revit.


#2

It would probably be helpful if we could see more of your graph. There’s likely an easier way to do this, but from first look you should probably be using list levels on your Count node. Right now you’re counting the number of sublists not the number of items in each sublist which I think is what you’re wanting to do.


#3

Sorry about that. Here is the complete map to this point. The excel file shows all of the items that are being tracked at this point on it. The model has many more elements with assigned addresses that may become part of the spreadsheet very soon. But for each item in the model being tracked, there are multiple pieces that will have the same address. So what I was trying to show in the image is that for each item for the spreadsheet list above, the model elements below have different number of corresponding, but identical addresses that the spreadsheet should be assigning to.


#4

I think you want a dictionary. It looks like you’re trying to look up elements based on a value and assign new values to those elements.
image


#5

I think my issue is, if I have in my spreadsheet “DRS323”, I may have “DRS323” 17 times in the model. so I just want the spreadsheet count to duplicate entries everytime “DRS323” is found. Once I have that, I can use that mapping to get all the other columns applied to assigned parameters.

Cycle.list has been suggested, but I wasnt sure how to use the tool with a count that may vary. That is why I point to this part of the image (below) to show that “DRS323” is showing 17 times, then “DRS322” shows 13 times. Length of lists and pushing data to all those instances (not just the first) is where I am stuck at the moment.
image


#6

i use UniqueId as key, more reliable


#7

Like I mentioned before, your issue with counting is List Levels. You’re currently counting the number of sublists in your list. Changing List Levels to @L2 will allow you to count the number of items in each sublist.
image

The other problem you have is that your lists are not in the same order. If you’re going to cycle the value based on the number of times it shows up in the model you need to make sure you’re duplicating the correct value. Use a sort node to sort both the excel data and the Revit data. You’ll also want to make sure there are no additional values in either list.

Even doing it this way, you’ll have to duplicate the values for each excel column. I really think it’s easier to set up a dictionary for each column using the lookup value (ex. DRS323) then getting the column value based on the parameter value in Revit. The number of duplicate values in Revit doesn’t matter this way.