Re: Sorting Arrays

2023-08-12 Thread Bob Sneidar via use-livecode
I formatted the sortKeys as I would an SQL query or an LC sort, but then I needed to isolate the key from the parameters because I couldn’t assume the sort key was simply the first word. Sent from my iPhone > On Aug 12, 2023, at 09:36, J. Landman Gay via use-livecode > wrote: > > I used a

Re: Sorting Arrays

2023-08-12 Thread J. Landman Gay via use-livecode
I used a short, one-dimensional numbered array: put the weekdayNames into tDataA split tDataA by cr simpleSortNumberedArray tDataA, "descending,text" But as Alex explained, one dimension wasn't enough. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software |

Re: Sorting Arrays

2023-08-12 Thread J. Landman Gay via use-livecode
Got it, thanks. The array was numbered but I didn't have enough dimensions. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On August 11, 2023 7:03:33 PM Alex Tweedly via use-livecode wrote: On 11/08/2023 23:00, J. Landman Gay via

Re: Sorting Arrays

2023-08-11 Thread Bob Sneidar via use-livecode
Send me what you have. Thanks. Sent from my iPhone > On Aug 11, 2023, at 17:02, Alex Tweedly via use-livecode > wrote: > >  >> On 11/08/2023 23:00, J. Landman Gay via use-livecode wrote: >> On 8/10/23 2:29 PM, Alex Tweedly via use-livecode wrote: >> [ ... code from earlier posting ...] >

Re: Sorting Arrays

2023-08-11 Thread Alex Tweedly via use-livecode
On 11/08/2023 23:00, J. Landman Gay via use-livecode wrote: On 8/10/23 2:29 PM, Alex Tweedly via use-livecode wrote: [ ... code from earlier posting ...] I couldn't get this to work until I altered it, but I was using a very simple array. What type of array data did you use? I think I'm

Re: Sorting Arrays

2023-08-11 Thread J. Landman Gay via use-livecode
On 8/10/23 2:29 PM, Alex Tweedly via use-livecode wrote: Combining my "traditional" way as above, and your example, I came up with a  simpler way to do the same thing: on simpleSortNumberedArray @pArrayDataA, pSortKeys    local tKeys, tSeq, tOneSortKey, tSortCommand    put

Re: Sorting Arrays

2023-08-10 Thread Bob Sneidar via use-livecode
I see you are sorting the keys of the array. I’ll give your method a try. Bob S On Aug 10, 2023, at 12:29 PM, Alex Tweedly via use-livecode wrote: And - overall, an alternate suggestion. I think your way is a bot complex. Combining my "traditional" way as above, and your example, I came up

Re: Sorting Arrays

2023-08-10 Thread Bob Sneidar via use-livecode
Thanks Alex, not sure how I missed that. I was only testing for a specific use case and only tried numeric descending. Bob S > On Aug 10, 2023, at 12:29 PM, Alex Tweedly via use-livecode > wrote: > > > On 09/08/2023 00:15, Bob Sneidar via use-livecode wrote: >> Has anyone come across a

Re: Sorting Arrays

2023-08-10 Thread Alex Tweedly via use-livecode
On 09/08/2023 00:15, Bob Sneidar via use-livecode wrote: Has anyone come across a need to sort a numbered array by the values of the different keys? Here you go. Absolutely I have needed that quite often now. I tend to use sequences (numbered arrays) often - maybe too often. Up until now

Sorting Arrays

2023-08-08 Thread Bob Sneidar via use-livecode
Has anyone come across a need to sort a numbered array by the values of the different keys? Here you go. Keep in mind that there is no error checking so I have no idea what would happen if you provided a sort key that didn’t exist in the array. on sortNumberedArray @pArrayDataA, pSortKeys