Sorting list problem

please i want sort list and make index list (1 ,2 ,3,…)
as photo below (the sort pending on survey and don’t index but the list be
4
california

2
newyork
(where can i put sort block in this photo)

So thanks

Hi there,

Since you have indexes as properties in your object, this can be done pretty easily!

Start by creating a list of empty objects which is the same length as your list of unsorted objects.
The, for each item in your list of unsorted objects, simply place them at their index position in this new list!
You can see blocks to do this below:

You can view a project which uses this sorting method here.

You can remix this project and try it out with different lists of objects in ObjectList and different amount of Labels on the screen.

This app assumes that:

  • There are at least as many items in your objectList as there are labels on the screen. If you have 3 items in list, bur 4 labels, one of the labels will show undefined.
  • Your index values on each object in your objectList are 1) unique values and 2) do not exceed the length of your list. For example, if your list has 7 objects, but one of the objects has an index value of 8, this sort function won’t work since there won’t be a position #8 on your sortedList to insert this object.
2 Likes

its awesome
this make sorting
i want also add index or series (1,2,3,…) to sorting list.

1 Like

Thx
i do it
merge two list (index list) & (sorting list)

1 Like