June 10, 200421 yr 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
June 10, 200421 yr 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.
June 11, 200421 yr 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.
June 11, 200421 yr 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... 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.
June 11, 200421 yr 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