Sorting cards problem solved

J. Landman Gay jacque at hyperactivesw.com
Mon Jan 3 00:41:43 EST 2022


There seems to be some interest in the recipe content, or maybe the puzzle, given the number of 
downloads. At any rate, if you downloaded already, please replace the Sort button with the 
revised script:

on menupick pWhich
   put the last word of pWhich into tFld
   sort cards by the short id of this cd -- import order; keep first 13 cards at front
   mark cds where there is a fld "category" and fld "category" <> empty -- real recipes only
   sort marked cards by field tFld
   if the num of cd "index" <> 1 then
     set the num of cd "index" to 1
     set the num of cd "eggsaver" to 2
   end if
end menupick

Or if you want a fixed version, it's here for a week:
<https://www.dropbox.com/t/icSZGckteBUq0gZf>

And...the client is pleased but noticed it all sorts very nicely except for the last card, 
which is in the correct category but out of alphabetical order. Anyone care to figure out why?

    - sort by title -- okay
    - sort by category -- Last card is wrong. Others are okay.

BTW, I tried Alex's suggestion of adding Title fields to the first two cards but LC hung until 
I hit Cmd-period. But Mark Wieder says it worked for him. I'm staring blankly.


On 1/2/22 2:46 PM, J. Landman Gay via use-livecode wrote:
> Well, it was an interesting puzzle. The "mark" property has come up before but I didn't think 
> it through enough. This seems to work:
> 
>    put the last word of pWhich into tFld -- popup menu with fld names
>    sort cards by the short id of this cd -- import order; keep first 13 cards at front
>    mark cds where there is a fld "category" and fld "category" <> empty -- tag real recipes only
>    sort marked cards by field tFld -- "category" or "title"
> 
> Those who have never used The Ancient Xtalks may not know about the mark command. I used it all 
> the time back in the dark ages but didn't think the solution would be so obvious. Mark Wieder 
> jogged my memory.
> 
> So, duh. I hope I'm not kidding myself.
> 
> There's one day left before the link I posted expires. I've tagged 20 recipes I want to try. 
> You might like to do that too. The client doesn't mind, he wants to share the stack with the 
> world and is debating whether to fund a standalone so people won't have to install LC.
> 


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list