4 Replies Latest reply on Mar 12, 2013 1:26 PM by vlight

    Visual indication for sorted column in List view

    vlight

      Title

      Visual indication for sorted column in List view

      Post

           In FM11, I'm using the "sorted column" script (as found in the FM11 Training file, Bonsai), and the sorting of the columns is working great.  I'd like to implement one additional feature, and don't know how best to accomplish it.  See the Yellow column head in the attached file.  THAT is the type of thing I would like to accomplish:  In List view, when a column is being sorted, I'd like that column's label to be visually different from the non-sorted columns.  Any ideas?  

      ss-want_visual_indicator.png

        • 1. Re: Visual indication for sorted column in List view
          philmodjunk

               Conditional formatting can change the text color of the layout text serving as the column header.

               $$SortColumn = "Country"

               might be the conditional format expression for the yellow text in your screen shot. Your sort script would then use:

               Set Variable [$$SortColumn ; value: "Country" ]

               when it sorted records by the Country field.

          • 2. Re: Visual indication for sorted column in List view
            vlight

                 Thank you. That works.  

                 I did find that I had to put the additional step directly under the "Else If" step in each section of my sort script, in order for it to work properly.

                 Also, I found that the value for the global variable ($$SortColumn) had to be an exact match to the text used for the column label.

                 That surprised me...  the global variable ($$SortColumn) seems to work magically like a custom fuction -- I was under the impression that you could give a variable, local or global, any name you wanted, but this one at least seems to be carrying some logic with it -- I'm curious as to how it works so well!  There must be a lot I still have to learn about global variables.

            • 3. Re: Visual indication for sorted column in List view
              philmodjunk

                   Also, I found that the value for the global variable ($$SortColumn) had to be an exact match to the text used for the column label.

                   This is not the case. You can use can name the variable as you want as long as  you use $$ to make it a global variable, but the value to which it is set, must exactly match the quoted text in the conditional format expression and the name used in the script must match the name used in the conditional format expression.

              • 4. Re: Visual indication for sorted column in List view
                vlight

                     As usual, you are correct.  Thank you.

                     I tested it by changing the value in both places to "xyz" , and it still highlighted the correct Column Head Label.

                     So... for my review...   (2 places = the Set Variable step in the script, and the conditional formatting formula on the column head)

                     •  The "$$GlobalVariableName" is arbitrary, but must be the same in both places.

                     •  The variable's "value"  is also arbitrary, but must be the same in both places.

                     Thanks again!