At 08:26 AM 3/20/2008, Lin MacDonald wrote:

I used to do this using variables which doesn't seem to work
well anymore.  I can get all my subtotals to work using DBCalc,
but, how do I add up results from a DBCalc?  How do I capture
that value?

Lin,

FYI, the traditional sub-totals, totals and grand-totals, using
the Variable Expressions, are still supported and working well in
the latest and greatest versions of R:BASE 7.6 and Turbo V-8 for
Windows.

The key is to pre-define all variables and make sure that each
variable is calculated on the correct band (section). You also
need to make sure that appropriate variable(s) are "Reset" for
each defined "Break". Finally, make sure to "Clear Variables
After Printing".

All this can be achieved by pre-defining variables as "Before
Generate" and "After Generate" actions in report designer.

Take a look at the sample report (SubTotalsAndTotals) in RRBYW14
to demonstrate the use of Sub-Total and Grand Total Using DB Calc
Option vs. Sub-Totals and Totals Using SUM OF Option.

Hare's a sample report output:

http://www.rbase.com/rbg76/reports/SubTotalsAndTotals.pdf

Having explained and demonstrated the use of variable sub-totals,
totals and grand-totals, we strongly recommend the use of "DB Calc".

Did you know that you can capture DB Calc results as Variable in
reports?

Here's how:

01. While in Report Designer, assign a <Component ID> to DB Calc
    object

02. Use the following GETPROPERTY command as "Before Generate
    Custom EEP" for the appropriate DB Calc band.

03. Example:

    CLEAR VARIABLE vCustInvoiceTxt, vCustInvoiceTot
    SET VARIABLE vCustInvoiceTxt TEXT = NULL
    SET VARIABLE vCustInvoiceTot CURRENCY = 00.00
    GETPROPERTY CustomerInvoiceTotal VALUE vCustInvoiceTxt
    SET VARIABLE vCustInvoiceTot = (FLOAT(.vCustInvoiceTxt))
    SET VAR vPercentage = (ROUND(((.vCustInvoiceTot/.vCoverPageTot)*100),2))
    PROPERTY CustomerPercent CAPTION .vPercentage

    where CustomerInvoiceTotal is the Component ID for (SUM(InvoiceTotal))
    DB Calc

    Calc Type: Sum
    Reset Break[0]: Company

And that's all there is to it!

Here's sample report to demonstrate the use of capturing DB Calc
results as variables.

http://www.rbase.com/rbg76/reports/SalesAnalysis.pdf

A sample application to demonstrate the use of such feature is
also included on the 2007 and 2008 R:BASE 7.6/Turbo V-8 Super
Advanced Training CD.

Folder: \CapturingDBCalcResultsAsVariablesInReports
Database: DBCalc
Associated Report: SalesAnalysis
Startup File: CapturingDBCalcResultsAsVariablesInReports.DAT

Updated versions of RBG76/RBG8 SAT Sample Applications:

R:BASE 7.6 SAT Applications: http://www.rupdates.com/rbg76SAT/
R:BASE Turbo V-8 SAT Applications: http://www.rupdates.com/rbg8SAT/
2008 SAT Sample Applications: http://www.rupdates.com/sat2008/

Very Best R:egards,

Razzak.


Reply via email to