O7: Report subtotalling on a calculated field

Geir Fjærli omnis at sunshinedata.com
Wed Jan 27 11:51:20 EST 2010


Yeah, I believe that was it. Stuff like that has started to exist only in my dusty old secondary brain cells, which I have long since forgotten how to access.

Thanks! Will try tomorrow when I get online with the customer again...

Geir :)

Den 27. jan. 2010 kl. 17.39 skrev jma:

> Hi Geir,
> 
> Triggers an old trick from Omnis 3 and that still works with O7 as far as I remember...
> Put your invisible calculated field (#1...) BEFORE the first section of your report (Report Header, Page Header, whatever it is)
> The have this field in the sort criteria...
> It should work...
> 
> 
> Le 27 janv. 10 à 14:54, Geir Fjærli a écrit :
> 
>> 
>> Hi all.
>> 
>> I am working on a nice little Omnis 7 report. Basically it runs through a single table, containing a code, a year and an amount. The report should put this into a matrix with the years horizontally and the codes vertically. So I simply do a print report on the main file. Then I set repeat factor to zero, and in the record section have calculated vars for each year, with calculations like:
>> 
>> Year1Amount = Amount*(Year=FirstYear)
>> Year2Amount = Amount*(Year=FirstYear+1)
>> And so on...
>> 
>> This works just fine. Looking at the record section (repeat factor = 1) I get all the records correctly calculated into the correct year.
>> 
>> But there is a second criteria: The subtotals should be generated based on the first two characters of the code only. So if I have codes names C10, C11 and C12 they should all be subtotaled as C1. So something like this:
>> 
>> C10 : 34
>> C11 : 44
>> C12 : 10
>> ---------------
>> C1  : 88
>> ---------------
>> C21: 12
>> C25 : 33
>> ---------------
>> C2 : 45
>> ---------------
>> 
>> So what I have done, but which does not work, is create a calculated field for the two character code, with a calculation like this:
>> 
>> Code2chars = mid(Code,1,2)
>> 
>> and then use Code2chars as the first sort field for the report, with subtotallng created. Again looking at the report with the record section showing I get this:
>> 
>> C10 : 34
>> ---------------
>> C1  : 34
>> ---------------
>> C11 : 44
>> C12 : 10
>> C21: 12
>> ---------------
>> C2 :  66
>> ---------------
>> C25 : 33
>> 
>> So as you can see, it looks likeCode2chars is calculated too late to influence the trigger for the subtotal.
>> 
>> This definitely triggers memories of having been there and done that before, but unfortunately it does not trigger memories of the solution. Does anyone have a hint? Can a calculated memory only variable be used as a sort field and subtotal trigger like this, or do I have to solve this differently?
>> 
>> The customer says "Do it with a procedure instead", but I hate to give up on problems like that when I suspect there is a valid approach somewhere.
>> 
>> TIA,
>> Geir :)_____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>> 
> 
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com




More information about the omnisdev-en mailing list