4 Replies Latest reply on Mar 22, 2010 6:13 AM by MikeDunglinson

    ONE SORT SCRIPT FOR MANY BUTTONS

    MikeDunglinson

      Title

      ONE SORT SCRIPT FOR MANY BUTTONS

      Post

      I have several different list reports consisting of 6-8 columns each. I would like one sort script allocated to many buttons which would allow the user

      to sort by a specific column by clicking the button at the top of each column.

      I do not want to use TABLE view which allows for ascending and descending sort options on each column title.

      I cannot use the filemaker context menu right click option in list view because I have to allow field entry in browse mode which I do not want.

       

      I could write a script for each column in each list report but I would end up with dozens of scripts which would be untidy.

      I could allocate the relevant sort to each button without a script but this does not give me ascending and descending options  unless I have two buttons per column

       

      This may not be possible but then at least I could stop banging my head agains the wall

       

      Any Ideas would be greatly appreciated

       

      Mike

       

        • 1. Re: ONE SORT SCRIPT FOR MANY BUTTONS
          RickWhitelaw

          Check out passing Script Parameters to a generic sort script. Make the text at the top of each column (in the header) a button that calls the sort script. Pass the name of the field contained in the given column as a Script Parameter in the button setup. Then sort by Get(ScriptParameter). This is not exact syntax. The manual or help file will supply that.

           

          RW

          • 2. Re: ONE SORT SCRIPT FOR MANY BUTTONS
            MikeDunglinson

            Thanks Rick

             

            I am not there yet, not sure how to pass the script parameter to the "sort" script step as normally you only

            get the chance to use a field in the script sort command. I have tried to pass the the script parameter to a calculating

            global field but not sure wether I am on the right track?

             

            Any further help would be appreciated

             

            Many Thanks

             

            MIke

             

            • 3. Re: ONE SORT SCRIPT FOR MANY BUTTONS
              RickWhitelaw

              When you set up the button behavior, select "perform Script" and select your sort script. Let's say this "button" is a simple text block that has "Date" in it and is placed in the header above your actual date field. When you select your script you'll see you can enter an optional script parameter. Enter "YourTable:: DateField". Now in your sort script sort by the script parameter using Get(ScriptParameter). This will work as it references a field. Now, let's say you have a "Name" column. USING THE SAME SCRIPT, set up this other button to perform the script and use "YourTable:: Name" as the script parameter. This way you can recycle the same script but pass a different parameter to produce the results you need. This should be enough to get you started. I don't have FM open in front of me, so check syntax before implementing, but this is the idea.

               

              RW

              • 4. Re: ONE SORT SCRIPT FOR MANY BUTTONS
                MikeDunglinson

                Thanks Rick

                 

                Got that now I will try it out later

                 

                Once again many thanks for the help

                 

                Mike