From {L01, L03, L04, L05, L07} To {L01, L03-L05, L07}
I am trying to figure out how could I convert a list with all the levels where a furniture type are to a more reduced list ommiting consecutive levels.
I want to convert a list with a lot of values to a shorter one with the first and the last value of the different secuences that are in the list. Finally the idea would be to convert this values to strings with a dash betwen the first and last value of each secuence to finally be added to a parameter in the family type and show the location of each type in the schedule.
Please let me know if I could clarify more my issue and thanks in advance!
Thanks for the comments @awilliams@Dimitar_Venkov. Find attached a couple of images to clarify the issue in question.
Looking forwards to your answers.
And @Vikram_Subbaiah and @Yna_Db, folloowing the schedule that I have with the previous Dynamo script and on the bottom the two possible ways to explain the location of the furniture that I would like to achieve.
If I get it well, you want to gather levels names where a type of furniture is present and create a parameter value by concatenating the first and last of these names?
Exactly, I want to simplyfiy my schedule to show where each type of furniture is in a more reduced way.
What I can’t figure out is how to chop a flatten list with all the levels where the family type is.
I though of a kind of conditional value in the select node to pick up and elements if the Index value [n-1] has == to the index value [n] + 1. Maybe I could chop the list in this cases to then pick up the first and the last value.
Once you have your levels filtered down to integers you can group consecutive values together. Then you just need to do a little IF magic to get your levels to single values or paired mins and maxes.
Thanks so much @Nick_Boyts, I’ll read more about GetKeys and List.GroupByKey to understand how they work, Also let’s see if I figure out the magic node. But this is a great advance!