Expressions

An expression is a string which defines a formula or criteria, that's evaluated at runtime. The expression may be a combination of variables, constants, strings, dates and operators/functions. For instance 1000 format `` gets 1,000.00 for US format, while 1.000,00 is displayed for German format.

  

When working with dynamic data in tables, grids, reports, or hierarchical structures, it is often necessary to determine the position of each item within its context. The ConditionalFormat, ComputedField, FormatColumn, and FormatCell objects support a variety of auto-number expressions that help with numbering, tracking, and identifying item positions dynamically. These expressions allow for improved formatting, sorting, analysis, and conditional logic based on the placement of items.

The ConditionalFormat, ComputedField, FormatColumn, and FormatCell objects support auto-number expressions for items in the following ways (detailed below):

  1. number index 'format', indicates the index of the item within its current context (list, table, group, etc.)
  2. number apos 'format', indicates the absolute position of the item, which is a global reference across all items, regardless of hierarchy
  3. number pos 'format', indicates the relative position of the item within its immediate parent or group
  4. number opos 'format', Indicates the relative old position of the item, tracking its position before any changes or reordering
  5. number rpos 'format', Indicates the relative recursive position of the item, considering its position within its group and any hierarchical structure
  6. number rindex 'format', number rapos 'format', and number ropos 'format', These work similarly to number rpos 'format', but provide the recursive index, recursive absolute position, or recursive old position, respectively. They reflect the item’s position within a recursive or nested context.

Additionally, it supports parent and root unary operators to access the values of parent or root items as explained:

  1. parent (unary operator), refers to the parent item of the current item. This expression allows access to values or properties associated with the immediate parent in the hierarchy or structure
  2. root (unary operator), refers to the root item of the current item’s hierarchy. This expression allows access to values or properties of the highest-level item in the entire structure, regardless of how deeply nested the current item is

These operators can be used in combination with predefined constants, operators, and functions as outlined here.

Usage examples:

The predefined operators for auto-numbering are:

  1. number index 'format', indicates the index of the item. The first added item has an index of 0, the second added item has an index of 1, and so on. The index of an item remains the same even if the order of the items is changed by sorting. For example, 1 index '' starts the index from 1, while 100 index '' starts the index from 100. The number represents the starting index, and the format defines the character set to be used for specifying the index. If the format is not provided, the index is represented as numbers. For instance, 1 index 'A-Z' results in the index being formatted as A, B, C... Z, BA, BB, BZ, CA, etc. Similarly, 1 index 'abc' formats the index as: a, b, c, ba, bb, bc, ca, cb, cc, and so on. You can also use other number formatting functions to modify the returned value. For example, 1 index '' format '0||2|:' groups the numbers into pairs of digits, separated by a colon character.

    In the following screen shot the FormatColumn("Col 1")  = "1 index ''"

    In the following screen shot the FormatColumn("Col 1")  = "1 index 'A-Z'"

     

  2. number apos 'format' indicates the absolute position of the item. The first visible item has an absolute position of 0 when the scrolling position is at the top, the next visible item is 1, and so forth. The number defines the starting position, while the format consists of characters specifying how the position should be represented. For example, 1 apos '' retrieves the absolute position starting from 1, whereas 100 apos '' retrieves the position starting from 100. If no format is provided, the absolute position is displayed as a numerical value.

    In the following screen shot the FormatColumn("Col 1")  = "1 apos ''"

    In the following screen shot the FormatColumn("Col 1")  = "1 apos 'A-Z'"

  3. number pos 'format' indicates the relative position of the item. The relative position represents the placement of a visible child item within its parent’s collection of children. The number defines the starting position, while the format consists of characters that specify how the position should be represented. For example, 1 pos '' retrieves the relative position starting from 1, whereas 100 pos '' retrieves the relative position starting from 100. If no format is provided, the relative position is displayed as a numerical value. The key difference between pos and opos becomes evident when filtering items in the control, as opos retains the original position before filtering, while pos reflects the updated position within the visible subset. For example, when no filter is applied to the control, pos and opos return the same value. However, when a filter is applied, opos retains the item's original position in the complete, unfiltered list, while pos reflects the item's new position within the filtered list.

    In the following screen shot the FormatColumn("Col 2")  = "'<b>' + 1 pos '' + '</b> ' + value"

    In the following screen shot the FormatColumn("Col 2")  = "'<b>' + 1 pos 'A-Z' + '</b> ' + value"

  4. number opos 'format' indicates the relative old position of the item. The relative old position represents the placement of a child item within its parent’s collection before any changes, such as reordering or filtering. The number defines the starting position, while the format consists of characters specifying how the position should be represented. For example, 1 opos '' retrieves the old relative position starting from 1, while 100 opos '' retrieves it starting from 100. If no format is provided, the relative old position is displayed as a numerical value. This differs from pos, which reflects the updated position after modifications. The difference between pos and opos becomes apparent when filtering items in the control. For instance, when no filter is applied, both pos and opos will return the same result, as the items are in their original order. However, when a filter is applied:
    opos retains the item's original position in the unfiltered list, reflecting its place before the filter was applied.
    pos updates to show the item’s position within the filtered list, based on the visible subset after filtering.
  5. number rpos 'format' indicates the relative recursive position of the item. The recursive position indicates the position of an item within its hierarchy, taking into account not only the item's own position but also the positions of its parent items in the hierarchy. The relative position refers to the position of the visible child item within the parent’s collection of child items. The number defines the starting position for the numbering. The format follows the pattern "delimiter|format|format|...". If no format is provided, the delimiter defaults to a dot (.), and the positions are formatted as numbers.

    In the following screen shot the FormatColumn("Col 1")  = "1 rpos ''"

    In the following screen shot the FormatColumn("Col 1")  = "1 rpos ':|A-Z'"

    In the following screen shot the FormatColumn("Col 1")  = "1 rpos '.|A-Z|'"

    In the following screen shot the FormatColumn("Col 1")  = "1 apos ''" and FormatColumn("Col 2")  = "'<b><font Tahoma;10>' + 1 rpos '.|A-Z|' + '</font></b> ' + value"

  6. number rindex 'format', number rapos 'format' and number ropos 'format' are working similar with number rpos 'format', excepts that they gives the index, absolute position, or the old child position.