Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

scripting 'sort record' - not using restore

Featured Replies

I've been tring to sort reports based upon the contents of a field that the user selects (checkbox set). I started by saving various 'sort records [restore]' scripts but after typing over 100 scripts from the possible combination of 512 I got fed up and visited fmForoums.

So all you kind bods of much knowledge? Is they a way out of this, can I script sort orders?

Thanks

Interesting. I don't know how well it would work, but you might give users some choices using globals, then use GetField() calcs as the sort criteria:

gSort1 (global, text)

gSort2 (global, text)

gSort3 (global, text)

iSort1 (calculation, text result) = GetField(gSort1)

iSort2 (calculation, text result) = GetField(gSort2)

iSort3 (calculation, text result) = GetField(gSort3)

Users choose the real names of the fields they want to sort with in the gSort1, gSort2, gSort3 fields. Use value lists for these. Then the sort script has one sort defined as iSort1, iSort2, iSort3.

You would need to give Ascending/Descending choices for each sort choice, and figure some way to deal with dates and numbers as they sort differently from text.

mrafs: find out from the users which of the 512 sort orders they are most likely to use. I bet it'd be less than a dozen.

  • Author

edner: ok the users only asked for 8 reports.... but with the combination of user specified drop down 'find' menus my report generator can create over a million unique possible combinations.

-ok i admit i have a problem.. but I'm not an addict OK... wink.gif

edner:thanks for the lateral lead..

I have the following fields/line items:

monthDate

className

pupilName

I create:

sumChoice (for my tickbox with a value list of the above fields)

subsum01_c

subsum02_c

subsum03_c

I script a calc field for each subsum calc field (i used a custom function to save time repeating the script):

i.e. subsum01:

case(middleValues(sumChoice;1;1)="monthDate{returnSymbol}";monthDate;

(middleValues(sumChoice;1;1)="className{returnSymbol}";className;

(middleValues(sumChoice;1;1)="pupilName{returnSymbol}";pupilName; "")

subsum02:

case(middleValues(sumChoice;2;1)="monthDate{returnSymbol}";monthDate;

(middleValues(sumChoice;2;1)="className{returnSymbol}";className;

(middleValues(sumChoice;2;1)="pupilName{returnSymbol}";pupilName; "")

Then a script using the valueCount function to sort the coresponding fields dependant on how many values the sumChoice has.

This all works so far.. I hope to add content fields into the report by using similar 'case' calculations.

The only problem so far it that is method seems to take aprox 50% longer to generate the report.

You could do away with the Case statement and speed up the process a little by using GetField( Substitute( MiddleValues( sumChoice;1;1 ); "

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.