Skip to main content
Hello everyone,

 

 

Is there a way to sort a list using only a part of the attributes in a list--specifically a number?

 

 

What I need to do is re-order attributes according to an ID number from lowest to highest. Here is what the attributes look like:

 

 

34N27W_100700      34N28W_700700        35N27W_100100     35N28W_700100

 

 

These need to be placed in fields according to the order of the last six numbers only.

 

 

35N27W_100100      34N27W_100700         35N28W_700100    34N28W_700700

 

 

If I create a list out of these attributes, I can only sort alphabetically, which produces the wrong order.

 

 

 I have tried separating the numbers into a list that I can sort but then the rest of the ID gets lost and I'm having trouble matching it up again. Does anyone have any ideas about how I can make this happen?

 

 

Thanks!

 

Hi Justin,

 

 

If the format is always ssome characters]_]6 digits], this way might be effective: 1) Replace each string with reversed format i.e. .6 digits]_]some characters]. 2) Create a list of these strings. 3) Sort the list. 4) Rename the list elements to the original attribute names. 5) Replace each string with reversed format again.   To reverse the format, use the StringReplacer that settings are: Text to Find: ^(.+)_(.+)$ Replacement Text: \\2_\\1 Use Regular Expressions: yes

 

Takashi
Thank you Takashi. I was over-thinking the process. This method worked great. Thank you so much for your quick answer.

 

 

Justin

Reply