TFlexCelReport.SetExpression Method
Sets a user-defined expression to be used in the report. Different from SetValue this method will evaluate the <#tags> in "value". This allows you to provide formula functionality to end users, and to reuse the same report for different formulas.
Syntax
Unit: FlexCel.Report
procedure TFlexCelReport.SetExpression(const name: string; const value: TReportValue);
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | name | string | Name of the expression to set. Case insensitive. |
const | value | TReportValue | Value of the expression. |
Examples
You could ask the user for an expression in an edit box, and then before running the report do:
flexCelReport.SetExpression('MyExpression', EditBox.Text);
Then, if you write <#MyExpresion> on a cell, the expression will be evaluated and entered into the cell. If the user enters "<#evaluate(<#Order.Amount> * <#Order.Vat>)>" in the edit box, this formula will be evaluated into the cell. The user can write any <#tag> that could be used in an expression defined directly in the template.