Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
It is not possible to sum rounded subtotals!!
Message
From
26/12/1998 15:07:48
 
 
To
24/12/1998 18:33:58
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00169097
Message ID:
00170501
Views:
34
>>>>David, i have the following table, for example:
>>>>
>>>>Person Salary
>>>>------------------
>>>>Edward 1.4
>>>>Edward 1.4
>>>>Michael 1.4
>>>>Michael 1.4
>>>>Paul 1.4
>>>>Paul 1.4
>>>>
>>>>I want do show subtotals rounded for each person and
>>>>display the sum those rounded subtotals in summary band.
>>>>Report for the data aboe must produce the following result:
>>>>
>>>>Person Salary
>>>>-----------------
>>>>Edward 3
>>>>Michael 3
>>>>Paul 3
>>>>------------
>>>>Total 9
>>>>
>>>>Can you give me instructions how to to this using report variables?
>>>
>>>OK, I'm sending you a "salary.exe" which is a self extracting zip file. Run it from anywhere and extract to a folder of your choice. I've included a .prg which will create an .fxp when it's run. So I've used both report variable and a simple program to solve your problem.
>>
>>Thank you very much David. I think it is the best hind I have
>>got from UT this year!
>>I have modified your function to make it generic since I have
>>actually a number of subtotals:
>>
>>function TOTAL
>>PARAMETER subTot, prmVARIABLE
>>store eval(m.prmVARIABLE) + m.subTot to (m.prmVARIABLE)
>>RETURN m.subTot
>>
>>so in grouop footer I can put a single field
>>
>> total('sum_salary', round(per_s,0))
>>
>>The intresting thing is sum_salary report variable:
>>
>>calculate sum
>>value to store 0
>>initial value 0
>>
>>From where have you learned this way to change report variable in UDF ?
>>Do you have some other such tricks available?
>>I is surprise for me that changing the value to store is possible.
>>
>>I also have some other generic udf's to make tricks in reports.
>>Those functions will use public variables to store previous
>>values and so I can dedect group change.
>>
>>Thank you very much for this wonderful trick. It works in VFP also.
>
>My pleasure. I'm real glad it worked fine.
>I'm really indebted to Lisa Slater (who is in New Zealand these days) for teaching me about the report writer. She wrote an excellent booklet some years ago called "The Foxpro 2 Report Writer". It was available from Pinnacle publishing. And might still be around. Lisa's a programming genius.

David, have you read the Dragan's reply?
It seems that it is possible to do it using 3 report variables.
Vars are calculated in the order as they apper in the variable list.

The trick is that second variable expression uses inside iif()
the value of third variable. This allows to sum previous group when
in the next group header !
This work faster since calling udf from reports is slow.
What do you think about this?

I tried to use Lisa's coolbutton class but without success.
She wastes her time for application generator as I read from her
article in the ms vfp site.
Andrus
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform