May 4, 201114 yr I hope some of you find this useful. Blog post and sample file here: http://www.fitchandfitch.com/2011/05/filemaker-portal-sorting/
May 4, 201114 yr This is interesting. I like the sort respecting the data type of the field (you could also sort by more than one field). Don't forget you need to re-populate the global upon modifying/adding portal records.
May 4, 201114 yr Well done, Fitch ! But I have two questions regarding the Custom sorting... 1) Why it works with 10 and NOT with 9 ? ( I didn't find any particular v.10 feature ) 2) Why it doesn't work with the script debugger activated ?
May 4, 201114 yr Author Don't forget you need to re-populate the global upon modifying/adding portal records. Good point. The example file is very basic. In real-world use I tend to avoid using portals to create records during data entry, but I wanted to make it easy for people to play around with the example data. Well done, Fitch ! But I have two questions regarding the Custom sorting... 1) Why it works with 10 and NOT with 9 ? ( I didn't find any particular v.10 feature ) 2) Why it doesn't work with the script debugger activated ? Thank you very much! 1) I only tested in FM 11, but as you say it should work in 9. I don't know. 2) I am able to custom sort with the debugger on. Please let me know if you figure it out!
May 4, 201114 yr Please let me know if you figure it out! This appears to be a FileMaker bug ( may be fixed on 11 ? ). If I put a Custom Dialog with $custom ( after the set $custom variable step ), the whole script works; but w/o the dialog doesn't. I tried to set the $custom to evaluate as a number, with no avail. I'll try other ways and let you know.
May 4, 201114 yr I've developed a virtual list based sorting technique that has some similarities. Will try to put up an example sometime soon.
May 14, 201114 yr Attached is a virtual list based mod to the technique. An advantage is that you have a single sort script that you pass a field name to using getFieldName(). You can also reverse-sort and with some effort do multicolumn sorts. PortalSortingVL.fp7.zip
May 16, 201114 yr Author Nice one -- thanks, Bruce. I'm planning a followup article and would like to include your file (with attribution of course) along with a couple of other mods I've received, if that's all right with you.
May 16, 201114 yr That would be great, thanks. I need to make a few more mods but the basic idea is already there.
May 24, 201114 yr Author Bruce, it seems like the file you posted relies on the child IDs being consecutive and starting with 1. Am I missing something?
May 24, 201114 yr Bruce, it seems like the file you posted relies on the child IDs being consecutive and starting with 1. Am I missing something? You're not missing anything except that this was a quickly thrown together proof of concept. The problem is easily solved. For the moment - left to the reader to do so.
May 25, 201114 yr Author Bruce, you're killing me! I am wrapping up my followup article, but without your file. If you have time to "easily solve" this, awesome, if not it will give me an excuse to write another article.
May 25, 201114 yr Bruce, you're killing me! I am wrapping up my followup article, but without your file. If you have time to "easily solve" this, awesome, if not it will give me an excuse to write another article. I will be posting about this in the near future myself. But here is a basic revision! PortalSortingVL2.zip
May 26, 201114 yr Author Excellent, thanks Bruce! Followup article is now up: FileMaker Portal Sorting Redux
June 1, 201114 yr Hi Bruce, May be I missed something. In your file, when there are empty value in Sales, the sorting does not work when sort descending
June 2, 201114 yr You are correct. It's a demo. It's a solvable problem but the level of rigor and completeness put into demo files varies.
June 2, 201114 yr Author I suppose you'd "pad" the list with zeros (or something -- would need to account for negative numbers). I dig what you've done Bruce, but for now I will stay with the (relative) simplicity of my original approach.
Create an account or sign in to comment