Jump to content
Server Maintenance This Week. ×

Script Step: Sort Records by Calculation


This topic is 4907 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Name: Sort Records by Calculation

Type: Script Step

Parameters: fieldNameList [ValueList], sortOrderList [ValueList]

These are both set by specify calculation dialog boxes. It is the users responsibility to make sure they balance - otherwise script step returns error ("invalid parameters" or some such).

fieldNameList is a valueList of field names.

sortOrderList is a valueList containing: ascending, descending OR 'valueList' for custom order.

Behaviour:

if ( ValueCount ( fieldNameList ) ≠ ValueCount ( sortOrderList ) ) then ERROR "invalid parameters" (as above)

Perform sort with field order given in list, using sortOrder to determine individual field sort order.

Example usage:

Sort Records by Calculation ( "MonthsOverdue¶DueAmount" ; "Descending¶Descending" )

Workaround [Mac only]:

Put it in a script wrapper with those two parameters. Have sort fields present on layout to enable use of following code within PerformAppleScript:

"sort by { field "" & Substitute( $fieldnameValueList ; "¶" ; "", field "" ) & "" } in order { " & Substitute ( $sortorderValueList ; "¶" ; ", " ) & " }"

Link to comment
Share on other sites

This topic is 4907 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.