August 6, 201411 yr Hey all, I have a portal which contains a sort based on a field called ItemName. I have used a custom sort order based on a value list called SortOrderA. The thing is, if a certain condition is met, I would like the field ItemName sorted by value list SortOrderB. Is this possible? Thanks Jalz
August 6, 201411 yr Here are 2 links that I really like: http://www.nightwingenterprises.com/demos2014/demo1301.html http://filemakerhacks.com/2011/04/07/portal-sorting-part-2/ The second link is something I used a couple times.
August 6, 201411 yr I believe the easy solution is to use two portals, each with its own sort order, and show one or the other depending on the condition.
August 6, 201411 yr Hide one or the other portals with Data > Behavior > Hide objects when. You can stack the portals and hide the portal. Fields inside 'stick' with the portal and respect the hide as well.
August 11, 201411 yr Author Thanks all, I used the Hide object option. I thought there might have been a 'neater' solution.
January 29, 201510 yr Are there any advantage to stacking and hiding the portals compared to putting them on separate tabs or sliding panels?
October 24, 20169 yr Hello All, hoping to revive this old thread. I have created a script that uses the idea presented on FMHacks (http://filemakerhacks.com/2011/04/07/portal-sorting-part-2/) The idea behind the script is to create 2 sortfields, one of which will sort ascending and the other descending. A clever trick (using ScriptParameter) sets these fields to the contents of the various working fields in the portal. The script toggles asc to desc and vice versa so you can sort up and down with serial clicks. Set key to itself to redraw the portal So here is the setup: fields "serial", "FN", "LN", "sortfield_asc", "sortfield_desc" Portal sort order is by "sortfield_asc" ascending, "sortfield_desc" descending. Nothing else is in the sort order. Script is triggered and it sets "sortfield_asc" to "LN", "sortfield_desc" to "", and the portal gets sorted by LN in an ascending order. So far so good. What should happen is that if the script is triggered again, then it sets "sortfield_asc" to "", "sortfield_desc" to "LN", and the portal gets sorted by LN in an descending order. But instead, this is what happens: Script sets "sortfield_asc" to "", "sortfield_desc" to "LN", but the portal gets sorted by "serial" in an ascending order. "serial" is not part of any definition or sort order. I have the sort fields in the portal temporarily and I can see that they are set to what they are supposed to be set to but they are not sorted. For the life of me I can't figure out what is wrong here. Any suggestions, ideas would be most appreciated. These are the actual script steps: #These 3 variables must be set up in this order:Set Variable [ $sp; Value:Get ( ScriptParameter ) ]Set Variable [ $$sortDirection; Value:If ($sp = $$fieldName and $$sortDirection = "asc"; "desc" ; "asc" ) ]Set Variable [ $$fieldName; Value:$sp ]#Setting the primary key to itself refreshes the portal contents Set Field [ practice::_Gkey; practice::_Gkey ] This is what the portal setup looks like: 0Untitled.tiff Edited October 24, 20169 yr by Asu Image did not show
October 24, 20169 yr It's a nice technique, and I use it a lot - make sure your Button has the script assigned correctly, and that sorter_ac and sorter_desc are both correctly defined in the their Field setup
October 24, 20169 yr sorter_asc and sorter_desc are both defined as text fields. The funny thing is that one half of the script works as it should but the other is totally off the wall. Or rather, the script does what it is supposed to do but the portal sorts what it is NOT supposed to sort.
Create an account or sign in to comment