How do I make a DBCalc field to put code into?
I am a relative beginner.
I want to do a calculation in the summary of a report.
I was able to easily create dbcalc4: Sum(LastYearSales)
and dbcalc9: Sum(IncDecfromLastYear).
Now I want to make a new calculated field to express
the change as a percentage: dbcalc9/dbcalc4
( or I could say: Sum(IncDecfromLastYear)/Sum(LastYearSales) )
The problem so far is that I can't figure out how to get a
field in which to put the OnCalc code,
other than to do it on the Design Tab
by clicking the DBCalc button.
If I do it that way, even when I put code into the OnCalc
spot that will compile without errors,
when I run the report, I get a message that DBCalc10 must
be bound.
If I bind it, what I bound is what I get, regardless of the
OnCalc code.
How can I make a new place to put this oncalc code?
Thanks!
Susan Mitchel
I want to do a calculation in the summary of a report.
I was able to easily create dbcalc4: Sum(LastYearSales)
and dbcalc9: Sum(IncDecfromLastYear).
Now I want to make a new calculated field to express
the change as a percentage: dbcalc9/dbcalc4
( or I could say: Sum(IncDecfromLastYear)/Sum(LastYearSales) )
The problem so far is that I can't figure out how to get a
field in which to put the OnCalc code,
other than to do it on the Design Tab
by clicking the DBCalc button.
If I do it that way, even when I put code into the OnCalc
spot that will compile without errors,
when I run the report, I get a message that DBCalc10 must
be bound.
If I bind it, what I bound is what I get, regardless of the
OnCalc code.
How can I make a new place to put this oncalc code?
Thanks!
Susan Mitchel
This discussion has been closed.
Comments
DBCalc component are good only if you need a very simple calculation
performed. Once you need to start accessing these values and manipulating
them, you will want to make your calculations manually using the TppVariable
component and its OnCalc event. You may still be able to keep your two
initial DBCalc components, but instead of using another DBCalc for the third
calculation, try using a TppVariable.
Note: When using a TppVariable, be sure to set the proper data type by
using the combo box in the top left of the designer.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
What tab is tppvariable on: Data View, Calc or Design?
I did try going to the Variables "aspect" of the Calc tab
but I'm not sure how to make one.
Thanks,
Susan
In the Report Designer (design tab) on the Standard Toolbar at the top there
is a component that looks sort of like a little blue calculator (similar to
the DBCalc icon without the table in the background).
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I just had to use the correct type of object to begin with.
My standard toolbar was not showing, so I kept using DBCalc.
I made the variable with this code:
Value := (DBCalc9.Value/DBCalc4.Value)*100;
and it works.
Thank you for your help!!
Susan