Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Building a conditional SUM
Message
 
To
23/12/1998 22:00:20
Marcelo Codino
Mystic & Faith - Sistemas -
Buenos Aires, Argentina
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00170147
Message ID:
00170226
Views:
17
>Hi all,
>
>I need to build a conditional SUM and I want to include it in a Report.
>I have the following instruction that works in an SQL statement but not like a fixed field at report´s feet.
>
>SUM(IIF(a.plan,a.val_cuot,a.amount)) AS n_amount.
>
>TIA

Marcelo, you can use report variable for that. Go to VFP menu/Report/Variables create a n_amount variable there, set "Initial value" to 0 and put the expression

IIF(a.plan, n_amount+a.val_cuot, n_amount+a.amount)

in "Value to store". Set "Calculation" to "Nothing"
then show your variable in the report footer.

Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform