SortRecordsByJSON_AppleScript ( sort_array )
Dynamic sorting for hierarchical field order to create nested subsummaries (macOS only)
Average rating: 5.0 (1 vote) Log in to vote
Thomas Siebert - Show more from this author
http://www.t-seabird.de |
"sort" :
[
{
"field" : "tablename::fieldname1",
"order" : "ascending"
},
{
"field" : "tablename::fieldname2",
"order" : "descending"
}
]
}
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Dynamic sorting for hierarchical field order to create nested subsummaries.
Use the Scriptstep "perform AppleScript" with the option "Calculated AppleScript".
Deliver an JSON-Array in following form:
[
{
"field" : "tablename:: field1",
"order" : "ascending"
},
{
"field" : "tablename:: field1",
"order" : "descending"
}
]
You may use following calculation to generate the JSON:
JSONSetElement ( "[]" ;
[ "[0]field" ; GetFieldName ( tablename::field1 ) ; JSONString ] ;
[ "[0]order" ; "ascending" ; JSONString ] ;
[ "[1]field" ; GetFieldName ( tablename::field2 ) ; JSONString ] ;
[ "[1]order" ; "descending" ; JSONString ]
)
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.