Jalz Posted August 6, 2014 Posted August 6, 2014 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
Steve Martino Posted August 6, 2014 Posted August 6, 2014 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.
comment Posted August 6, 2014 Posted August 6, 2014 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. 2
LaRetta Posted August 6, 2014 Posted August 6, 2014 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. 1
Jalz Posted August 11, 2014 Author Posted August 11, 2014 Thanks all, I used the Hide object option. I thought there might have been a 'neater' solution.
HALBURN Posted January 29, 2015 Posted January 29, 2015 Are there any advantage to stacking and hiding the portals compared to putting them on separate tabs or sliding panels?
Asu Posted October 24, 2016 Posted October 24, 2016 (edited) 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, 2016 by Asu Image did not show
webko Posted October 24, 2016 Posted October 24, 2016 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
Asu Posted October 24, 2016 Posted October 24, 2016 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.
Recommended Posts
This topic is 3020 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now