Thanks for the help Razzak.
You're an angel
Very Best R:egards,
Daniele

----- Original Message ----- From: "A. Razzak Memon" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Thursday, January 03, 2013 3:06 PM
Subject: [RBASE-L] - Re: expression using DBCalc in Report


At 07:20 AM 1/3/2013, Daniele Barbieri wrote:

R:BASE 9.5 (32)
In a report, I need a variable that calculates an expression using two or more DBCalc.
What should I do? i.e. varname=(DBcalc1 - DBCalc2)

Daniele,

Here's how:

01. Assign ComponentID to the first DBCalc control, such as DBCalc1
02. Assign ComponentID to the second DBCalc control, such as DBCalc2
03. Place a Label Object to show results and assign ComponentID to the Label object, such as Difference 04. On appropriate band, define the following code as "Before Generate Custom EEP"

    -- Band Before Generate Custom EEP
    CLEAR VARIABLE vDBCalc1Txt,vDBCalc1,vDBCalc2Txt,vDBCalc2,vDifference
    SET VARIABLE vDBCalc1Txt TEXT = NULL
    SET VARIABLE vDBCalc1 CURRENCY = 0.00
    SET VARIABLE vDBCalc2Txt TEXT = NULL
    SET VARIABLE vDBCalc2 CURRENCY = 0.00
    SET VARIABLE vDifference CURRENCY = 00.00
    GETPROPERTY DBCalc1 VALUE vDBCalc1Txt
    GETPROPERTY DBCalc2 VALUE vDBCalc2Txt
    SET VARIABLE vDBCalc1 = (FLOAT(.vDBCalc1Txt))
    SET VARIABLE vDBCalc2 = (FLOAT(.vDBCalc2Txt))
    --SET VARIABLE vDifference = (.vDBClac1 - .vDBCalc2)

       SET VARIABLE vDifference = (.vDBCalc1 - .vDBCalc2)

    PROPERTY Difference CAPTION .vDifference
    RETURN

That's all there is to it!

For a sample application to demonstrate the use of such technique, you may take a look at the 2012-2013
Super Advanced Training (SAT) Sample Applications.

Database: RBU_SAT
Report: SalesAnalysis

Very Best R:eg
ards,>
Razzak

www.rbase.com
www.facebook.com/rbase




Reply via email to