Grouping Unique Element List

Would anyone be able to help with this?
I have generated a list of pipe fittings that are grouped by size and length. I can filter by unique items with the string list to give me 20 unique cases but I cant do the same with the elements because of the ID.
I want to plug the element list into the set parameter value to give the fittings an individual mark.
Closest I have got is shown on the schedule image, you’ll notice items 9 and 16 are repeated because I grouped by type.

@Craig.Pryce ,

you can try GroupByKey and use ElementType as criteria…

Thanks for getting back to me so quickly.
Unfortunately that creates the same list without grouping into the unique items. If I group by element type it disregards the pipes with different lengths and also the bends of different diameter.

1 Like

@Craig.Pryce ,

i tried via length

You need to use GroupByKey to group all fittings by Size then another GroupByKey @L2 to group those sublists by Length. This will give you nested lists of fittings grouped by Size then Length. You can then just pull the first item from every sublist to have one of each type.

Another option is to take the Size and Length of each fitting and combine the values into a single string, just for the purpose of grouping similar combinations. You can then group fittings by combination and take the first item in each unique list again for one of each type.

1 Like

@Nick_Boyts thanks for giving this some thought. I’m not sure if I am missing the obvious. I’m struggling to generate the sublist you mentioned. depending on how I group them the keys don’t match. Thanks for any help.

You need to take the group of fittings by size and then group those sublists by length. It needs to happen consecutively otherwise you’re not maintaining any relationship between the two values.

Hi @Nick_Boyts I had a go at that thanks. It has given me a grouped list by size and length but not the types. I’ve been going round in circles for a few hours now.

@Nick_Boyts ive got pretty close with this, not sure if its conventional method! the only think that hasnt worked is the bends have not been split into the two sizes, everything else is ok

worked for the pipes

Hard to tell what’s going on without seeing the parameter values. Pipe bends may use different parameters since they could have different inlet and outlet sizes, but that’s just a guess.

somehow it has worked now. Out of desperation I added in another group parameter with the same pipe size parameter input.