Taking the Elements of one parameter in a List and converting them to String to fill another parameter of the same Elements

Hello helpful people,

I work mostly on Condos, meaning we have many repetitive floor plates and also units. When we create marketing sheets to sell these units, we often prepare them as packages that list all the occurrences of the unit on individual floors to give buyers options. In revit, we call these “Suite Types”, which is a project parameter unique to areas that has a simplified assigned value (example - A1 is a 1 bedroom unit, so on and so forth.)

Using dynamo and revit, I was able to take all the instances of unit “Numbers” with equal “Suite Types”, turn them a string and add that to the “Comments” parameter. The only trouble I am having now, is that I had to manually update the Code Block (x) value so that the project would not append ALL the “Numbers” at once into each “Comments”. Is there a formula that can automate this process? I thought of using the Count function to act as an upper limit in a sequence, but that does not individually process the instances of my (x) value.

I cannot attach my work as a new user, so see this wetransfer link: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free.

MN

@RAW_MN ,

that would be a quick way…

KR

Andreas

1 Like

Sounds like you want List.GroupByKey so you can create sublists of equal values and only join those sublists.

Thanks Draxl and Nick - but neither solution worked.

Draxl - unless I am doing it wrong, that code run just makes a list and doesn’t iterate through the code respective to the inputs independantly.

Nick - I am using that command to get the list of two parameters tied to the same key.

Maybe I am not describing it properly but you can see by my image below what the end goal is. I am taking all the elements with a specific key, and putting them as a string into another parameter. The end goal is to automate the process, and I believe I am getting caught up at the code block.

@RAW_MN ,

looks like you grabbing the whole list instead of the value …

show your code :wink:

KR

Andreas

It’s hard to tell what you’re doing without showing us the node previews to see what data you’re actually dealing with.

It would be easier to group the objects once, instead of twice. Group areas by Suite Type then get the Number. Use String.Join to concatenate the numbers but sublist and then write to all elements in that group.

Hey Draxl,

My goal is to grab the list at the respective key and add it to the “Comments” parameter as a string. I want to see the list of “numbers” with the same “suite type” in the “comments” parameter. My screenshot above shows a resolved example of the solution, but my code can only do 1 sublist at a time by changing the “x” value 1 number at a time, instead of iterating through the list and appending it to the respective “comments” parameter.

Please let me know if this makes sense - see below for my latest dyanmo script with the Watch command on all relevant info.

Thanks,
MN

That’s because you’re using String from Array which converts an array (n-dimensional list) to a single string. You need a node that takes a single list, like String.Join, so that you can iterate over each sublist.

Thanks Nick and Draxl,

I solved it with your advice! Simplified the code, here is the result:

And here is the dynamo script - simplified as per your comments:

This will save my office HUNDREDS OF HOURS a year.

MN

1 Like