Fitch Posted May 4, 2011 Posted May 4, 2011 I hope some of you find this useful. Blog post and sample file here: http://www.fitchandfitch.com/2011/05/filemaker-portal-sorting/
comment Posted May 4, 2011 Posted May 4, 2011 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.
Raybaudi Posted May 4, 2011 Posted May 4, 2011 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 ?
Fitch Posted May 4, 2011 Author Posted May 4, 2011 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!
Raybaudi Posted May 4, 2011 Posted May 4, 2011 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.
bruceR Posted May 4, 2011 Posted May 4, 2011 I've developed a virtual list based sorting technique that has some similarities. Will try to put up an example sometime soon.
bruceR Posted May 14, 2011 Posted May 14, 2011 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
Fitch Posted May 16, 2011 Author Posted May 16, 2011 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.
bruceR Posted May 16, 2011 Posted May 16, 2011 That would be great, thanks. I need to make a few more mods but the basic idea is already there.
Fitch Posted May 24, 2011 Author Posted May 24, 2011 Bruce, it seems like the file you posted relies on the child IDs being consecutive and starting with 1. Am I missing something?
bruceR Posted May 24, 2011 Posted May 24, 2011 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.
Fitch Posted May 25, 2011 Author Posted May 25, 2011 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.
bruceR Posted May 25, 2011 Posted May 25, 2011 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
Fitch Posted May 26, 2011 Author Posted May 26, 2011 Excellent, thanks Bruce! Followup article is now up: FileMaker Portal Sorting Redux
supernatural Posted June 1, 2011 Posted June 1, 2011 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
bruceR Posted June 2, 2011 Posted June 2, 2011 You are correct. It's a demo. It's a solvable problem but the level of rigor and completeness put into demo files varies.
Fitch Posted June 2, 2011 Author Posted June 2, 2011 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.
Recommended Posts