Expressions

Want create site? Find Free WordPress Themes and plugins.

Expressions are used for computations, evaluations or for prefixing values for a field .They are defined to enforce certain business rules in the application  .

An Expression may constitute fields, functions and operators and its result is always a value.

For instance,

Tto fix the discount in an invoice as 3.25, the expression may be set as 3.25. To calculate the value of any item in an invoice, the expression can be set as Rate* Quantity.

Some examples of operations where you use expressions:

  • To obtain a calculated value or to establish a validation rule, or to set a default field value for a field in a TStruct or a column in IView.
  • To  filter records using a criteria or to create a calculated field.
  • To set a condition for carrying out a task or series of tasks in an IView.
  • To calculate the values of parameters in an IView.
  • To obtain results using an SQL statement.

Points to remember

  • Expressions  can be defined in the Expression/Validate Expression property of the inputfield. It will be calculated or validated at runtime and the result will be populated into the field.
  • An expression can contain fields. These fields should have been defined earlier in the TStruct.For instance, to calculate the value of a product purchased, the fields  Quantity and Rate should be defined prior to the  current inputfield . In such cases, the values will change dynamically as the change occurs in the Quantity and Rate field.
  • You can use the following operators in the expression :
Operator Operation
+ Addition
Subtraction
/ Division
< Less than
> Greater than
= Equal to
# Not equal to
| Or operator
& And operator
$ To check if a string is a sub string of another string .For Eg: iif({ile}${agile},{Yes},{No})
  • String constants are denoted by enclosing them with { } .
  • You can also use functions in expressions.
  • Fields used in an expression are called parent fields. The field in which the expression is defined is called the dependent field. When parent fields are changed all its dependent fields are refreshed.
  • When a parent and dependent fields are both in the same grid, the parent value in the current row is used to refresh the dependent value in the current row.
  • When a parent field is non grid & dependent is in grid, all the values in the dependent column are refreshed.
  • When parent is in grid and dependent in non grid, when value of any row in the parent is changed, the value in the non grid is changed.
  • When a row is deleted in a grid DC, all the dependent non grid fields for every field in the grid are refreshed.

Examples for expressions

qty * rate

(qty*rate)-discount

(qty*rate)-(discountper * (qty*rate)/100)

iif(discount<1000, {T}, {Maximum allowed discount is 1000}) )

The above expression will return T if the discount<1000 else it returns “Maximum allowed discount is 1000”.

{Hi} + name {, go to Agile}

If name has a value “Peter”, the result will “Hi Peter, go to Agile”.

 

Did you find apk for android? You can find new Free Android Games and apps.