Jump to content

scripting 'sort record' - not using restore


mrafs
 Share

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

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 6432 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
 Share

×
×
  • Create New...

Important Information

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