Hi,
Today I was working on reading sum of selected rooms and writing it to parameter which worked fine for specific example (as shown in code block). But now I want to jump to bigger scale and perform it for every type on the list. I assume the elements on the list need to be groupped at first and then the rest could be performed as per cross lacing, but honestly I don’t know how to approach it properly. In attachment you can find my dyn file (1.3.2) apartment areas.dyn (19.9 KB)
Hi,
Have you tried List.GroupByKey ?
Thanks for the tip. I’m not entirely sure I know how to use this node. It gave me result I don’t completely comprehend - true, I have groups I wanted but I also have some unique keys that also should be included in groups…
They are indeed included in the groups, each “unique key” represent all the unique keys represented in the groups…
1 Like
Right, silly me! So the keys are the values I was looking for. Thanks for helping. I will report back if I managed to deal with it!
Hi again
This is the proper way to do it.
Depending on what you want to do, you could also use List.UniqueItems (Out of the box node), or List.CountOccurrences (Clockwork package).
Also, try to not use List.Create if not needed. Using List.Create with a single input is not really doing something relevant. This node is used if you want to metrge several elements (or lists) into a single list.
1 Like
Hm, I can’t seem to run my string starts with node with list…
My mind starts to boil - I can’t find a way to do actions per key using list as input for searchFor. Any ideas?
apartment areas v2.dyn (30.2 KB)
try playing with List at Level
click on the > next to the searchFor input
click use Levels and set it to L@1
Tried to play with that with no luck. I wonder if my whole node setup isn’t wrong in this case.
I also thought about using some kind of loop but only one i see is loop while - can I have whole sequence of nodes in a loop?
Generally speaking, if you need to loop in Dynamo, that means you’re either doing someting wrong or not using list-levels/lacing correctly
1 Like
Cross-product lacing or list level @L1 should do what you want.
1 Like
I tried that but I have errors down the line
Warning: List.FilterByBoolMask operation failed.
Specified cast is not valid.
I tried using levels in the list filter as well but didn’t manage to fix it.
This is driving me mad as it feels like there’s one small thing to close this…
can you show what you feed in to the str input of the String.StartsWith node?
Here it is:
As I said - it works when I give a specific string as searchFor but for multiple elements.
Try something like this :
Ps : The output of the middle node is : [[true,false,false,true,false],[false,true,false,false,true]]
2 Likes
A list.Transpose may also be in order between your String.Contains node and your List.FilterByBoolMask node. Look at how your data is formatted to know for certain.
2 Likes
One step further - it gives me properly two sums now of two input apartments as per your suggestion. Now I need to find a way to assign to those specific apartments but looks better now
Can you give some quick explanation why the original node didn’t work?
I’d very much like to thank you guys for all the input. I managed to accomplish what I aimed for! In attachment you will find my final solution and although I need to clear up description and maybe make it more easy to read - the solution is there. Thanks again - you made my day!
apartment areas.dyn (34.7 KB)
2 Likes