Group Query by Checkboxes (1 Viewer)

Weekleyba

Registered User.
Local time
Today, 07:24
Joined
Oct 10, 2013
Messages
586
I'm not sure why I can't figure this out.
I have a query that I want to show Location (ascending) textbox , but grouped by ServiceUnit (true) checkbox, then grouped by Tribal (true) checkbox.
How do I do that?
1619379803705.png
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 08:24
Joined
May 21, 2018
Messages
8,525
Maybe, but depends what you want.
That will bring the all True ServiceUnit to the Top then Start Sorting by location, but Tribal will not be grouped. If you add a sort to descending that will only sort within a location. So within a specific location the true Tribal shows before the false tribal.

If you sort by service, then tribal, then location you get the True Service First. Inside that you get the Tribal first by true then by false. Then within the Tribal groups you get it sorted by location.

If you want to show any record with True Service first, then all the records with True tribal (not in the first group) you may have to use a union query.
 

Weekleyba

Registered User.
Local time
Today, 07:24
Joined
Oct 10, 2013
Messages
586
Well with more manipulation, I managed to get what I wanted.
Not sure it's the 'right' way but, it works.
The result of the query is for the record source of a combobox.
I wanted the Location ascending, but grouped by the Service Unit and Tribal.
Also note, I didn't want 'Division of Facility Management' at the top, so I had to add an add'l expression.
So I got what I needed but it looks a bit ugly...
1619381714312.png


1619381757690.png
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 08:24
Joined
May 21, 2018
Messages
8,525
I might be wrong, but that makes it look like your table is wrong. Can it be more than 1 choice (service unit, tribal, DFM)? If it can be only one choice then it should be one field and you store the type.

SU_Tribal("Service Unit", "Tribal", "DFM".....)

Then this becomes very easy. Sort by SU_Tribal then Location.
 

Users who are viewing this thread

Top Bottom