Search code examples
filemaker

FileMaker Pro 14 - Pass Variable From Button Press


I have a number of columns, and I want to be able to have the user press the label for each column to sort the data alphabetically\numerically by that field.

I can already accomplish this rather easily, but not very efficiently. I could make one script for each column and set it to sort by that column, perhaps even creating a global variable to keep track of the direction. Instead, I'd like to reduce it to one script and pass a variable to the script based on what button\label was pressed.

So far I've found people saying you can change the color of each one and get the variable that way, but I don't want the category headers to be different colors. Yes, I could simply use a one-step process for each one, but no way to reverse it when they click it a second time. Any ideas?


Solution

  • You can pass a script parameter where you specify the script to be performed on the button. From there, you can specify what field to sort on and if you like, set global variables for how the fields were sorted (order and name) that you can use in conditional formatting to give visual feedback.

    There are lots of techniques out there for this, but this is one I have used especially for arbitrarily large data sets where sorts should not be done on calculations.