Jan & Razzak - A belated thanks for the replies. I have been working on
this off & on and found I was misinterpreting GETPROPERTY <Component ID>
TEXTVALUE 'varname' for use in forms and GETPROPERTY <Component ID>
VALUE 'varname' for DBCalc in reports. The subtle but distinct
difference is GETting TEXTVALUE vs. VALUE. After various permutations
with quotes, variable definitions, etc, I got it working by defining the
variables as text as Razzak said and using:
GETPROPERTY cidSumF3Miles VALUE 'vSumF3MilesTxt'
This captures the numeric value of the DBCalc as text. Next, FLOAT the
text values to numeric:
SET VAR vSumF3Miles = (FLOAT(.vSumF3MilesTxt))
and do the math.
It all works.
Doug
A. Razzak Memon wrote:
At 02:45 PM 2/5/2010, Doug Hamilton wrote:
Hi List - I have a report with a band that has two DBCalcs,
one sums miles (inte) and one sums Gallons (real). I'm trying
to GETPROPERTY the values of the DBCalcs to calc MPG. The
values I get are waaaay off (858 million miles and 4.006 E-11
gallons - good mileage, but not accurate :)
Here's the EEP that is located in the F3 band with the DBCalcs:
--BeforeGenerate EEP; F3 Band; StateMonth report
SET TRACE ON
SET VARIABLE vSumF3Miles INTEGER = 0
SET VARIABLE vSumF3Gals REAL = 0
SET VARIABLE vF3MPG REAL = 0
GETPROPERTY cidSumF3Miles VALUE vSumF3Miles
GETPROPERTY cidSumF3Gals VALUE vSumF3Gals
SET VAR vF3MPG = (.vSumF3Miles/.vSumF3Gals)
PROPERTY cidF3MPG CAPTION .vF3MPG
SET TRACE OFF
RETURN
Any ideas why the GETPROPERTYs are returning the wrong values?
01. First, capture the GETPROPERTY values as "TEXT" variable(s).
SET VARIABLE vSumF3Miles INTEGER = NULL
SET VARIABLE vSumF3MilesTxt TEXT = NULL
SET VARIABLE vSumF3Gals REAL = NULL
SET VARIABLE vSumF3GalsTxt TEXT = NULL
SET VARIABLE vF3MPG REAL = NULL
SET VARIABLE vF3MPGTxt TEXT = NULL
02. Then, convert the text values to appropriate type using the
FLOAT function of R:BASE.
SET VAR vSumF3Miles = (FLOAT(.vSumF3MilesTxt))
SET VAR vSumF3Gals = (FLOAT(.vSumF3GalsTxt))
SET VAR vF3MPG = (FLOAT(.vF3MPGTxt))
03. Now divide the values and you will get the desired result.
R:BASE Super Advanced Training Sample Library include an example
to demonstrate the use of such feature.
Very Best R:egards,
Razzak.