AddVar Method

[Top]  [Chapter]  [Previous]  [Next]

Applies to

IWPReport

Declaration

procedure AddVar(const Name: WideString; const Title: WideString; const Description: WideString; const Group: WideString; const StartFormula: WideString; const Format: WideString; const ParStyle: WideString; Mode: Integer; const LoopFormula: WideString; const GetTextForumula: WideString; WidthTW: Integer);

Description

This method adds a variable which can be added to the report template, just like a field. In contrast to a field a variable can only represent a number value. It is designed to keep the value between different loops of the same report group - therefore it can be used to create totals. Its value is modified by the assigned formulas "StartFormula" and "LoopFormula". The first formula is evaluated when the group the field is owned by is used first, the second formula is before each time (including the first) the group is used. This means that when the text of a group is evaluated the variables are already processed. Both the "StartFormula" and "LoopFormula" should be written as assignment to modify the value. (Exception function "add()").

Example: LoopFormula = "+=ORDERS.AMOUNT*ORDERS.PRICE".

Parameters

Name

The name of the variable

Title

The title of the variable

Description

The description what this variable does

Group

The group to add to, use "*" for current.

StartFormula

This formula is used to assign the start value. If empty or no assignment (not =, += etc) the initial value is 0.

Format

A string to specify the print format, use "CUR=€" use print EUROS, or "CUR=$" for Dollars.

ParStyle

The paragraph style to specify the character attributes.

Mode

The mode bits, to select and hide the variable.

LoopFormula

This formula is evaluated before each loop of the group, including first. Use "+=" to sum up a value or "add( field('orders.name'), orders.price)" to add a name which can be used in a chart. (not yet implemented)

GetTextFormula

This formula is used to create the text for the field.

WidthTW

This value is reserved.


[idh_iwpreport_addvar.htm]    Copyright © 2007 by WPCubed GmbH