Sorting search results - solution needed
Bob Sneidar
bobsneidar at iotecdigital.com
Tue Oct 23 16:58:16 EDT 2018
Come to think of it no. I didn't notice the items further down in the list with multiple periods. Your problems is very basic: You really have alpha-numeric data, which you are trying to sort numerically. It's a contradiction in terms.
Looking at the nature of your data, and assuming your data is not going to deviate from what you have provided, you have to break out the components of your values into three separate values, the integer portion (if any otherwise 0), the decimal portion (if any otherwise 0) and the alphanumeric portion (assuming that *ALWAYS* comes last).
But evn then, I see:
>> 10187
>>
>> 187c
>>
>> 18700
That's not alphanumerically sorted, nor is it numerically sorted! It's a non-sort!
Bob S
> On Oct 23, 2018, at 13:45 , Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> sort lines numeric by word 1 of each
>
>> On Oct 23, 2018, at 12:22 , Scott Seward via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> Hi,
>>
>> I need to sort the result set of a search. But the common sort mechanisms I’m familiar with won’t get me where I need. I’m sure this is a common problem and much better developers then I know the name of it and how to execute it in Livecode. Any help would be appreciated. Here is the problem:
>>
>> I execute a search for “187” and get the following results:
>>
>> NOTE: The search term will always start with one or more numeric characters and possibly be appended by punctuation or other alpha characters.
>>
>> Alpha sort
>>
>> Desired Sort
>>
>> 187
>>
>> 187
>>
>> 187.01
>>
>> 187a
>>
>> 187.02
>>
>> 187 (a)
>>
>> 187.1
>>
>> 187 (a)(1)
>>
>> 187.22
>>
>> 187 (b)
>>
>> 187.234
>>
>> 187 (b)(1)
>>
>> 187.3
>>
>> 187c
>>
>> 187.33
>>
>> 187.c
>>
>> 187.456
>>
>> 187.01
>>
>> 10187
>>
>> 187.02
>>
>> 18700
>>
>> 187.1
>>
>> 187 (a)
>>
>> 187.1.1
>>
>> 187 (a)(1)
>>
>> 187.1.2
>>
>> 187 (b)
>>
>> 187.3
>>
>> 187 (b)(1)
>>
>> 187.22
>>
>> 187.1.1
>>
>> 187.33
>>
>> 187.1.2
>>
>> 187.234
>>
>> 187.c
>>
>> 187.456
>>
>> 187a
>>
>> 10187
>>
>> 187c
>>
>> 18700
>>
>>
>>
>> Kindest regards,
>>
>> Scott
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list