Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Carry forward a group total
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01342833
Message ID:
01343386
Views:
22
>>>Let's say you need 12 totals .... one for each month ...
>>>
>>>Create 24 report variables; rnJanPrev, rnFebPrev, ... rnDecPrev, rnJanCurr, rnFebCurr, ... rnDecCurr. For the "Prev" variables, set the initial value to 0, set the expression to 0, set the calculate option to SUM and have them reset at end of report. For the "Curr" variables, set the initial value to 0, the expression to whatever field you need, and reset at the data group.
>>>
>>>In the OnExit expression of the data group footer enter this:
>>>
>>>
>>>_VFP.SetVar('rnJanPrev', rnJanCurr) AND _VFP.SetVar('rnFebPrev', rnFebCurr) AND ... _VFP.SetVar('rnDecPrev', rnDecCurr)
>>>
>>>
>>>In the data group footer, print (rnJanCurr - rnJanPrev) / rnJanPrev ... and so on.
>>
>>I think he tried this and it didn't work. Also you can not use AND with _VFP.SetVar, you need to use NVL function here...
>
>AND works just fine for me without any NVL. I can combine as many SetVar()s as I want in the OnExit expression.
>
>If it didn't work for him my guess is that he forgot to mark the previous variables as calculate SUM and reset it at end of report. That's the biggest mistake I see people make when trying to implemenbt this trick.

Yes, I think it was our mistake. (for me the second time!)

BTW, I think I know why I was thinking of NVL. You probably can use AND with _VFP.SetVar but you can not use it in conjunction with IIF() function or something.

I remember I needed to use NVL(), but I have to run, can not search at the moment.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform