O7: Report subtotalling on a calculated field

Jim Creak jim at jacsoft.co.nz
Wed Jan 27 15:37:30 EST 2010


Here's another way that I use, since you are in O7 you can still use  
# variables :)

Place a Hash variable above your first section,  that is the very top  
line of your report

#S1  =  mid(Code,1,2)

Sort by this variable.

In your record section have a hidden variable

#s2 = mid(Code,1,2)

and display that in your subtotal section. (You might be able to use  
#S1 instead of #S2, up to you to try :)  )


Thanks
Jim

JACSoft Programming Ltd.





On 28/01/2010, at 2:54 AM, Geir Fjærli wrote:

> 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




More information about the omnisdev-en mailing list