Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Totalling a report variable
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00580088
Message ID:
00580124
Views:
20
Alex,

If I understand what you're after then I think you've made things quite a bit too complicated for yourself <g>

You don't need to use report variables at all - you can simply use calculated expressions.

In the Total field in the detail band put the expression (Charges + Shipping).
Copy that field and paste it into the group footer band. Open the field expression and click the calculations button and choose Sum and Reset at: same field used for grouping v_caseinvoices_to_print.iCaseID).

I've done this with some of the sample data from the home() + 'Samples\Data\orders.dbf' and it works just fine. I've e-mailed you the sample report.

Cheers,

Andrew

>Hi,
>
>I have a report that prints lists of invoices by client; kinda like a credit card statement where you only see a list of invoice-totals and a total at the bottom.
>
>In this report the invoice totals are calculated on the fly and placed on a report variable called lyInvoiceTotal.
>
>The report is grouped by client, and each group prints on a new page. It looks a bit like this:
>Date:     Description:               Charges:  Shipping:   Total(lyInvoiceTotal)
>10/01/01  Order placed by Hillary    $150.00      $20.00   $170.00
>10/05/01  Flowers for Susy           $200.00      $45.00   $245.00
>
>Total:                                                     $415.00
>(The grand total ($415) is giving me a grand headache).
>Then another page is printed for another client
>
>I finally got it to work, but it's not pretty and much less intuitive, which means that if I have to change anything to this report in 3 weeks I'll probably go nuts. Here's what I've done:
>
>- Created report variable called lyInvoiceTotal with the following:
> - Value To Store: 0
> - Initial value: 0
> - Reset at: same field used for grouping (v_caseinvoices_to_print.iCaseID)
>
>- Created another report variable called lyPageTotal with the following:
> - Value To Store: lyInvoiceTotal
> - Initial value: 0
> - Reset at: same field used for grouping (v_caseinvoices_to_print.iCaseID)
>
>- The charges and shipping fields are actually return values from function that also update the lyInvoiceTotal variable (i.e. lyInvoiceTotal = lyInvoiceTotal + lyReturnValue)
>
>- In the detail band's entry event I call a function that sets lyInvoiceTotal to zero.
>
>- In the detail band's exit event I call a function that does just this:
>lyPageTotal = lyPageTotal + lyInvoiceTotal
>
>
>There has to be a more straight forward way to total report-variables than this. Any ideas?
>
>Thanks!
>
>Alex


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Previous
Reply
Map
View

Click here to load this message in the networking platform