sum

edited June 2018 in FastReport VCL 5
How do you add dollar fields vertically? I'm creating an invoice report. Each band multiplies quantity * price ea for a total on each line. I need to add up this total for all lines.

I am following the pdf for version 6 since there is no documentation for version 5. Page 60 gives some good info. I'm confused on how they get Group."ItemsTotal" which is their subtotal that they use to sum. My subtotal is a formula but when I try to insert that formula in the footer (Total: [SUM(<Group."[<WO-PartDetail."QuantityCompleted">*<WO-PartDetail."PartUnitPriceRect">]">,DetailData1)]) I get the error: "Unknown variable or datafield." I'm guessing I need to create a variable that does the math above (QuantityCompleted * PartUnitPriceRect). Does that sound right and if so...how?

Comments

  • edited 11:10PM
    Galin wrote: »
    How do you add dollar fields vertically? I'm creating an invoice report. Each band multiplies quantity * price ea for a total on each line. I need to add up this total for all lines.

    I am following the pdf for version 6 since there is no documentation for version 5. Page 60 gives some good info. I'm confused on how they get Group."ItemsTotal" which is their subtotal that they use to sum. My subtotal is a formula but when I try to insert that formula in the footer (Total: [SUM(<Group."[<WO-PartDetail."QuantityCompleted">*<WO-PartDetail."PartUnitPriceRect">]">,DetailData1)]) I get the error: "Unknown variable or datafield." I'm guessing I need to create a variable that does the math above (QuantityCompleted * PartUnitPriceRect). Does that sound right and if so...how?



    I think I found the answer so I'll put it here.

    Make group header, DetailData and group footer bands. For your line item totals, use a variable. To set that up, go to Report>variables. Create a top level (i.e. Cost) and then create a variable under that (i.e. ItemTotal). In my report, this variable expression is <WO-PartDetail."QuantityCompleted">*<WO-PartDetail."PartUnitPriceRect">. This new variable appears on the data tree under variables.

    In the DetailData, drag the variable to where you want the line item total.

    In the footer, insert a system text (use the ∑ button on the left). In the text field at the bottom, enter [SUM(<ItemTotal>, DetailData1)]. Voila!

    The instruction pdf is kind of confusing so hopefully this will help someone down the road.
  • edited 11:10PM
    This could be very useful for me too. I also need to make invoice reports. Cheers for sharing the solution, Galin.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.