Dynamic Break By

melmckee72

New Member
I'm working with a program which creates a report with multiple output displays. All the same data but sorted differently in each iteration.

I've got a temp-table created with all the data necessary, and trying to do the different sortations.

I defined some variables as sortfield1, sortfield2, etc and then assigned those variables the field names of the temp-table that I am using.
It seems to work correctly except when I try to do a last-of statement. Then I just don't get any data.

for each fout no-lock break by sortfield1 by sortfield2 by sortfield3:
accumulate fqtym (total by sortfield3 by sortfield2 by sortfield1).
if last-of (sortfield3) display accumm total by sortfield3 fqtym.
end.

any ideas on whether or not this is legal? and if it is why I can't get any output?
 
Never tried such a thing...but why not thinking about a Dynamic Query ?

Dynamic Queries are much more flexible than ordinar FOR EACH request.
 

jammerjim

New Member
melmckee72 said:
any ideas on whether or not this is legal? and if it is why I can't get any output?

You get get no data output at all when you add a last-of? Or just just no last-of data?

Anyway, the first thing that occurs to be is that you are sorting by 1,2,3 but your accum statement is by 3,2,1. That looks wrong to me, and could be messing things up.
 

melmckee72

New Member
Olivier_Desmars said:
Never tried such a thing...but why not thinking about a Dynamic Query ?

Dynamic Queries are much more flexible than ordinar FOR EACH request.


Interesting idea, but haven't been able to find anything about accumulating totals and subtotals in a dynamic query.

How would I go about that?
 
melmckee72 said:
Interesting idea, but haven't been able to find anything about accumulating totals and subtotals in a dynamic query.

How would I go about that?
Probably the old fashioned way - Using you own variables:
Code:
if vLastSortfield3 = sortfield3
then vfqtymTotal = vfqtymTotal + fqtym.
 
Top