**Operands**
The following operands are supported:

- variables (e.g. %myvariable)

- data fields (e.g. Sales, or MyTable:Sales)

- cross-tab header fields (e.g. #Field)

- numeric constants (e.g. 123, or 1.23, or 1.23e+4)

- text constants (e.g. "Hello world!")

- functions

Variables, data fields and cross-tab header fields may be enclosed in single quotes or square brackets, e.g. 'Total sales', [My field], 'Len'. It is necessary if they have space characters in names, or if they have the same names as functions (see below).

Note: while numeric constants must use the dot character as a decimal separator, strings can use both the dot and the comma characters, e.g. both "1.23" and "1,23" can be converted to 1.23.

**Functions**
I implemented more than 50 functions for expressions. When possible, I used SQL-like names rather than Delphi-like names.

Functions:

- basic math: Div, Mod, Round, Ceiling, Floor, Trunc, Abs, Sign

- trigonometric: Sin,Cos, Tan, Cotan, Radians, Degrees, Pi

- log and exp: Log, Log10, Ln, Exp, Power, Sqrt

- min/max: MinVal, MaxVal

- text: Upper, Lower, Trim, LTrim, RTrim, Substring, Left, Right, Repeat, Len

- date and time: Now, CurDate, CurTime, MakeDate, DateFromParts, MakeTime, GetDay, GetMonth, GetYear, GetHour, GetMinutes, GetSeconds

- logical: False, True, If

- conversion: ToNumber, ToText

- data: RecNo.

Aggregate functions (Min, Max, Sum, Count, Average, Var.P, Var.S, StdDev.P, StdDev.S) are also available. But there is a difference in syntax: they accept a text parameter, so field names must be enclosed in double quotes, e.g. Sum("Sales"). For consistency, I added a possibility to use double quotes when using aggregate functions outside of expressions as well.

As you can see, the functions that return the greater/lesser of two values are named MinVal and MaxVal. I could not name them Min and Max because these names are already used by aggregate functions.

Logical If function is especially useful in hypertext targets, hints and visualizers, because commands (including {$if}) are not available there. Example:

Code: Select all

`If(Len(Name)<100, "Hello "+Name, "Welcome to our planet!")`

RecNo returns an index of the currently processed record, RecNo(0) returns the index of record of the most nested data query.

Difference from similar Delphi functions:

- in RW, Round does not use bankers' rounding, it always rounds 5 up;

- in RW, in Round (unlike Delphi's RoundTo), the positive second parameter moves the rounding position to the right, i.e Round(12.345,1)=12.3, Round(12.345,-1)=10;

- in RW, the parameters of Log are (Number,Base) (instead of Delphi's LogN(Base,Number)