Sort ascend and descend.
Is there a way to make a button descend sort, and when I click it again it ascend sorts? Most websites/ data bases work in that fashion. It will only let me add one sort of the same value.
You can combine a script attached to your button and either a global variable or a global field for this.
Using a global variable:
If [$$sortOrder = "Ascend"] Sort [no dialog ; Restore ] //specify your ascending sort order Set Variable [$$sortOrder ; Value: "Descend" ]Else Sort [no dialog ; Restore ] //specify your descending sort order Set Variable [$$sortOrder ; Value: "Ascend" ]End IFRefresh Window // updates displayed value if you place $$sortOrder on your layout as merge text (FileMaker 11 only).
With FileMaker 11, you can even place $$sortOrder as merge text on top of a blank button so that it's name changes each time you click it.
I have filemaker 11, this is the easist way? I'm kinda of a newbie!! Whats $$ do or what does it mean?
$$ identifies the variable as a global variable, which means that the value of the variable will be retained when the script ends. In FileMaker 11, you can place text on your layout like this: <<$$sortOrder>> and it will display the value of the variable. If you put it on top of a blank button, your button's label text will appear to toggle back and forth between "Ascending" and "Descending" each time you click it.
For this use, it's pretty much a wash between using a global field or a global variable. With a global field, you can load the field with the default value you want to see and you can place the field directly on top of the button without using merge text format--which leaves off the << and >> which can make your layout a tiny bit cleaner when you work with it in layout mode.
It's also possible to specify an initial value for global fields by sneaking a Let function into a conditional text format expression on the merge text.
Here's conditional format expression you could assign to it: Let ( $$sortOrder = If ( IsEmpty ( $$sortOrder ) ; "Descending" ; $$sortOrder ) ; 1 )
Yea I see what your saying now. I dont need to show me what order its in I just want it to happen.
In which case, you don't need to assign an intial value to the variable as the script I originally posted treats an empty variable as though it contains "Descend".
Retrieving data ...