Get elements from mark values

Hi all

Is there any way to get elements from its mark values ?

at the beginning I extracted the mark values and then sorted naturally so that it can be in a ascending order. then I want to get elements from the sorted mark values list.

Is there any way to get elements from sorted mark values ? There are some repeated mark values so I want the elements of corresponding values.

Please find the snip below

image

1 Like

@shashank.baganeACM ,

you get the mark value from the element!

optional you can create a dictionary

1 Like

Unfortunately you can only use data to retrieve an element reliably if that data is unique in relation to the elements you are comparing the data to. For example you can use a room’s number to find a room, but might have duplicates which means some objects aren’t comparatively unique. If you manage to work with a unique value then you can use a workflow like below to rematch the objects.

If you want to ‘clump’ the objects together by their values, use the groupbykey node, or a dictionary. Personally dictionaries are clunky for me so I avoid them unless script performance is a factor at play.

2 Likes

Sounds like you should have used SortByKey instead of just Sort. However, this won’t get you natural sorting.

Instead, use GroupByKey to first group the elements. You could then naturally sort your new keys list and then compare the new and original key sorting to get the “change” in indices. Then just apply that “change” to your lists of grouped elements via GetItemAtIndex. That should get the grouped elements in their natural sorting order.