1 Reply Latest reply on Feb 17, 2011 10:18 AM by philmodjunk

    How to Sort Portal Rows (Ascending and Descending)



      How to Sort Portal Rows (Ascending and Descending)


      1. Create the following fields in your table:

      g_Sort Asc (global text)

      g_Sort Des (global text)

      Sort Portal Asc (Calculation Text: GetField( g_Sort Asc )

      Sort Portal Des (Calculation Text: GetField( g_Sort Des )

      2. Create your portal table relationship (any relationship you need to make your portal)

      Check "Sort Records" for the portal table

      Select field Sort Portal Asc and check Sort Ascending

      Select field Sort Portal Des and check Sort Descending

      3. Create the following script: "Sort Portal"

      If[ IsEmpty( g_Sort Asc ) ]

      Set Field[ Sort Portal Asc; Value: Get ( ScriptParameter ) ]

      Set Field[ g_Sort Des; Value: "" ]


      Set Field[ Sort Portal Des; Value: Get ( ScriptParameter ) ]

      Set Field[ g_Sort Asc; Value: "" ]

      End If

      4. Create a button using the portal headers:

      Right-click the header and select Button Setup

      In the dialog, select Perform Script

      Click Specify

      Select the script Sort Portal and enter the field full name into the parameter box 

      Example: If you are trying to sort the first name, and the field is Name_First, enter "Name_First" into the parameter box

        • 1. Re: How to Sort Portal Rows (Ascending and Descending)

          The above method has also been documented in the FileMaker Training Series.

          It's effective if you can work within it's limitations.

          An alternative is to create several copies of the same portal, but with different sort orders. These portals can be placed on different tabs of a tab control or on different layout. Clickint a button or selecting a value from a drop down can perform a script that then selects the appropriate tab or layout for the specified sort order and field.

          It can be very labor intensive, but sometimes is the only way to get the desired sort order.