List order


#1

Hi all,

I’m trying to copy some of my room parameters to the MEPspaces that are in that room. I managede to filter out the rooms that have spaces in them, but the order of the space list dosent match the rooms list. So the parameter values assigend to the spaces doesn’t match the room parameter values (see attached pic.)

Room_Spaces

 

 

 

 

 

 

 

If anyone has some suggestions, it would be much appreciated!

 


#2

Having not worked with spaces much… Is there a characteristic they both share? Number or name?


#3

Hi Johnp
The spaces have a built in parameter called “room name” which is the name of the room they are placed in, so mabye i could use that.
But when i compare the list of that parameter value, and my list of rooms, it’s not matching.

Is there away to make these list in the same order?


#4

2015-06-03_09h05_48


#5

I actully tried the sortbykey but i can see i was using it wrong :slight_smile:

Thanks for the example!


#6

Hi All… need some help. This should be pretty easy, but I can’t find the answer on the forum…

How do I achieve SortByKey in a natural ordering> 1,2,3,4…etc instead of 1,10,11,2,20…?!?


#7

Any tips on the above?!? I’ve just spend 3hours trying to find a solution…no luck

Sorting works perfectly in natural order if items in a list are just numbers, but if they are strings> sorting goes in a classical alphanumerical order (C1,C10,C11,C2,C20,C21…) Can anyone advise how I can sort the list in a natural order??

thanks for your help…


#8

Hi,

An empty string will always rate lower when sorting, that’s just how it is. The only solution is to add leading zeros to your numbers. Try the “List.WithLeadingZeroes” node from clockwork:


#9

To help with the sorting you could do the following with the out of the box nodes. It removes the first letter then adds the padding to the values then re-adds the text, once you are at this stage you could then use the sorting node again.

Of course you may want to use sort by key or something similar at the end if you have other data within and want to keep the element data with the sorting.