List.GroupByFunction doesnt work with function Round. Any solutions?

Hello guys, i wanted to sort my rebar in project by diameter, then by form, then by lengths: A, B, total.
I made already the grouping for diameter and form, but by lengths i got a problem: the values are too exact (14 digits after point) (see Page 1).


I try to round this value, but List.GroupByFunction doesnt accept the round as function.
Any ideas?
(I tried also List.GroupByKey, but it doesnt work with multi-lvl-lists)

Based on your screenshot it’s not a function. Notice how GetParameterValueByName returns Function and not values? That’s what the node is expecting. If you provide values it has nothing to apply as a function anymore.

The function gets applied to the input and the result is sorted. In your case you would have to round and sort the values but I don’t think that’s what you want. Instead, you can use SortByKey to sort the elements by their rounded values.

2 Likes

Thank you for your answer.
I want to keep the grouping (sub-lists) like it was: (grouping by 1-diameter and then by 2-form picture) And on this stage i want to add grouping by shared Parameter “RI_A” - and it is length and too precise, that you see on picture 1.

I understand that it should work as function, (please dont pay attention on connection between them on Picture 1) and when i add rounding as a part of function it doesnt work anymore (Round cannot be a part of function it works only with “double”). I added Picture 2.

SortByKey and GroupByKey dont work with sub-lists (i tried also, it works only on first step, till i havn’t done first and second grouping)

The total idea ist to give the same value of Parameter “Mark” to Rebar instances, that have the same diameter, Form, RA, Total Length rounded to 0.1 cm.
May be there is the better solution, that works?

I have done the task, using ListGroupByKey at lowest level (without sub-lists) and then intersecting

Sorry, I meant GroupByKey and not SortByKey. Both will work on sublists with the right list levels.

You can’t apply a function to a function. This is what I meant when I said you’d have to apply the round function to group the parameter values and not the elements since GroupByFunction uses one input for both. GroupByKey allows you to supply an element to group and a key to group by.

1 Like