UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Sortby value A, Group on B    
 
   
MrSiezen
post Aug 2 2007, 06:36 AM
Post #1

UtterAccess Ruler
Posts: 2,196
From: Den Bosch - Netherlands



Hi!

I've got a problem with the grouping and sorting of a report.

The report shows a list of unpaid invoices. These invoices should be grouped by debtor, and sorted by age of the debt.

So this is what it should look like:


Debtor Age
x 240 days
a 239 days
a 40 days
g 239 days
o 220 days

But how do I achieve this?
If I put the group by debtor first in the group/sort by menu of the report, it puts the whole list in order of the debtor's name.
If I put the order by age first in the group/sort by menu of the report, it doesn't group at debtor level anymore...
Go to the top of the page
 
+
niesz
post Aug 2 2007, 06:43 AM
Post #2

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



How is this list sorted?

EDIT: Are you talking about these two entries?

a 239 days
a 40 days

If so, they are sorted if you have built the Days expression in the QBE grid. 2 is less than 4. It is probably sorting the values as a string.

To sort by the value, you need to include a numeric expression of just the number of days and sort on that.
Go to the top of the page
 
+
MrSiezen
post Aug 2 2007, 06:57 AM
Post #3

UtterAccess Ruler
Posts: 2,196
From: Den Bosch - Netherlands



First by the age of the debt, then by the Debtor's ID

The example got a but unclear after posting it. In the example you see that X has the oldest debt open, and no other. Debtor A has the second oldest debt open, and also a more recent debt open. So they need to be grouped. Then debtor G has the oldest debt, etc...

Does this make clear what I want?

CODE

DebtorID  Age
X         240 days
A         239 days
A         40 days
G         238 days
O         220 days
Go to the top of the page
 
+
niesz
post Aug 2 2007, 07:02 AM
Post #4

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



I think you need to include an "Oldest Debt" column (possibly using a subquery or through joins) and then sort on that first. Then by Days.

DebtorID Age Oldest
X 240 days 240
A 239 days 239
A 40 days 239
G 238 days 238
O 220 days 220
Go to the top of the page
 
+
MrSiezen
post Aug 2 2007, 07:48 AM
Post #5

UtterAccess Ruler
Posts: 2,196
From: Den Bosch - Netherlands



Yup that's brilliance in it's simplicity! Got it to work now. Thanks!
Go to the top of the page
 
+
niesz
post Aug 2 2007, 07:53 AM
Post #6

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



NP.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 21st May 2013 - 07:30 PM