Using a variable in another calculation
Is here a way to use a variable in an calculation in another variables
caculation?
procedure TrptSalesNew.ppVariable2Calc(Sender: TObject;
var Value: Variant);
begin
value := tblReportW.fieldbyname('grossdue').asFloat -
tblReportW.fieldbyname('commission').asFloat;
end;
procedure TrptSalesNew.ppVariable3Calc(Sender: TObject;
var Value: Variant);
begin
value := ppVariable2.asFloat / tblReportW.fieldybname('seats').asInteger;
end;
caculation?
procedure TrptSalesNew.ppVariable2Calc(Sender: TObject;
var Value: Variant);
begin
value := tblReportW.fieldbyname('grossdue').asFloat -
tblReportW.fieldbyname('commission').asFloat;
end;
procedure TrptSalesNew.ppVariable3Calc(Sender: TObject;
var Value: Variant);
begin
value := ppVariable2.asFloat / tblReportW.fieldybname('seats').asInteger;
end;
This discussion has been closed.
Comments
Yes, this type of calculation should be possible in ReportBuilder. Remember
that if these two variables are in the same band, you will need to adjust
the z-order of the variables (send to back, bring to front) to ensure that
ppVariable2 is calculated before ppVariable3.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
calculations are done? I have serveral ppDBCalcs in a band that I want to
use in ppvariable calculation. If the calculatiions are dependent on the
z-order, then someone could come in during design time and unknowingly
bring an object to the front or send it to the back, thereby changing the
calculation.
Sorry, the z-order is the only way ReportBuilder knows which drawcommands to
render to a page at a given time. You will either need to inform your users
of this requirement, or perhaps create a utility that loops through each
drawcommand and ensures each of your variables are in the correct order.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Sorry, I must be loosing it today . The DBCalc components are meant to be
stand alone objects. If you would like to make calculations on data in your
report, I would recommend just using TppVariables. This way you can adjust
the Calc Order of these variables and your users will not be able to change
this even if they move the variables around. To access the Calc Order,
simply right click over some empty space in the current band and select the
Calc Order option from the popup menu.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com