Jan 13 2012, 11:42 AM
Alright, UtterAccess family... here's a good Friday-morning question:
I have a report with 3000 records. Currently, the entire report is sorted by field SampleDate.
There is another field, FieldA, that contains the following possible values: RF, LF, RR, LR, CO.
My customer would like the report to show all the CO values (from FieldA) at the top of the report...
But, all the other records should continue to be sorted by field SampleDate.
So, I'm "kind of" sorting by FieldA... sorting just enough to compile all CO's at the top of the report...
Any thoughts how I might best accomplish this?
Jan 13 2012, 11:46 AM
Add a Calculated field to the underlying query:
PrimarySort: IIF(FieldA = 'CO',0,1)
Then sort by PrimarySort, then SampleDate.
Jan 13 2012, 11:47 AM
Perhaps add a column to the query that tests for CO. If it is CO, assign it the value 1, otherwise the value 2 (a simple IIF() call may suffice)
Then in the report, you can use the sorting and grouping to sort on that column to ensure the CO records come first.
Edit: I posted and see another person gave a similar suggestion.
Jan 13 2012, 11:48 AM
When I have to do complex sorting, I usually add a sorting field. But since you only have two sorting requirement, maybe you could just create two subreports.
Just my 2 cents...
EDIT: Oops, guess I'm too slow today.
Jan 13 2012, 11:49 AM
In the sorting specifications of the Report object, create an Expression the provides your sort key ...
=IIf([FieldA] = "CO","A", "Z")
Then your your SampleDate as the secondary sort criteria
Jan 13 2012, 12:00 PM
MAN! I L-O-V-E this place (meaning, "UtterAccess")!
You guys rock!
Yes, yes... it worked like a charm.
Makes me wanna go do an awkward victory lap around the office, high-fiving coworkers I've never met!
Jan 13 2012, 12:02 PM
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here