Using a variable in a calculation
Hi,
I have a report laid out as such...
Title
Header
Group Header
Detail
Group Footer
Footer
Summary
The Detail section contains a variable, varSLUCTotal. This value stores a
calculation of Qty * Fee. This is my left to right math.
My problem is down in Summary band. I want to get the SUM of the
varSLUCTotal variable for the entire report and place that value into
another variable, varUCGrandTotal. varUCGrandTotal resides in the Summary
band, but i cannot determine how to add up the value of each group's
varSLUCTotal calculation.
I need this to get a picture of the total amount of sales included in each
group. My next step is to calculate the percentage of the Grand Total each
group makes up.
I would appreciate any assistance on this as i am completely stuck now. I
have looked through the manual and the NG to no avail.
Thank you,
Brian Hollister
I have a report laid out as such...
Title
Header
Group Header
Detail
Group Footer
Footer
Summary
The Detail section contains a variable, varSLUCTotal. This value stores a
calculation of Qty * Fee. This is my left to right math.
My problem is down in Summary band. I want to get the SUM of the
varSLUCTotal variable for the entire report and place that value into
another variable, varUCGrandTotal. varUCGrandTotal resides in the Summary
band, but i cannot determine how to add up the value of each group's
varSLUCTotal calculation.
I need this to get a picture of the total amount of sales included in each
group. My next step is to calculate the percentage of the Grand Total each
group makes up.
I would appreciate any assistance on this as i am completely stuck now. I
have looked through the manual and the NG to no avail.
Thank you,
Brian Hollister
This discussion has been closed.
Comments
I used Option 1, using my group total calculation to accumulate the detail
and the summary.
However, i now need to calculate the percentage each group's total is of the
grand total.
My calculation for that is as follows...
Value := ((Testing['varUCGrandTotal'] - Testing['varSLUCTotal']) /
Testing['varUCGrandTotal']) * 100;
However, the calculation always comes out to be zero and that jsut is not
right. I have played around with the Timing to no avail.
Any ideas on how to get this value calculated?
Thanks,
Brian
PS - All timings are currently set to;
CalcType = veTraversal
ResetType = veReportEnd
Take a look at the following example on calculation a percentage of a grand
total inside the report using lookahead values.
http://www.digital-metaphors.com/tips/UseLookAheadValueInCalc.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks for the tip! I should have been clearer though. I am using the
ReportDesigner outside of the Delphi environment. Essentially, your product
has been wrapped in a dll and given to me, meaning i don't have the ability
to write code into an IDE as your example does.
The report has now been update as follows;
Title
Header - Contains the grand total of all service lines (a DBCalc field using
a SUM of (Fee * Qty), set as LookAhead)
Group Header - Contains a group total (vSL = Value := (Testing['Sold'] *
Testing['UC']);) and a percentage of total sales(vPct)
Detail
vSL - CalcType = veTraversal
ResetType = veGroupEnd
vPct - CalcType = veTraversal
ResetType = veGroupEnd
The percentage is troubling me. Trial and error with different
configurations for the CalcType, ResetType, and LookAhead all result in
different values. Sometimes zeros and sometimes the same value for each
group????
I have attached a screenshot of the report designer as i would like to have
the output be. I hope i am making myself clear. I'm not to certain at this
point if i am doing so.
How can i get a percentage of total sales for each group (Code)?
Thanks,
Brian
ReportBuilder to build reporting solutions. The developers can then deploy
their reporting solutions royalty free to end-users. It is the
responsibility of developer to provide their end-users with tech support.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I'm a Delphi developer. The guy that developed the dll solution is sitting
right next to me and he does not know how to do this either. That is why i
am trying here.
We use Delphi 7 and RB 10.06.
I am attempting to get ready for a tradeshow in Chicago and need to be able
to show people how easy it is to design reports. But we can't figure out how
to do these percentage calculations.
Thanks,
Brian
Here is the same example implemented in RAP code.
www.digital-metaphors.com/tips/CalcUsingLookAheadValuesRAP.zip
We do not have all examples in both Delphi and RAP code. However, many
Delphi code examples can be easily translated to RAP code.
For future reference, it is helpful to us that you specify whether you are
using Delphi or RAP to code. Or even better, post in the RAP newsgroup -
then it is implied.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thanks for all you did. I was able to get what i wanted out of it. I
sincerely appreciate it.
I will take questions like this to the RAP group from now on.
Thanks,
Brian