Skip to main content

xSuite Interface Windows Prism 5.x – Online Help

Processing Tables

AddLineItem()

This function adds an artificial row to an index data table of the current document. The parameter list is of variable length and consists alternately of the full name of the target field in the table as defined in the field catalog (i.e., {table name}.{column name}), and the value to be inserted into this field.

Within a function call, only fields of the same target table may be addressed. If a value is not specified for all fields of the table in question, the remaining fields will retain their initial value.

Sub-tables can also be addressed, but then always specify the number of a concrete, already existing row for the parent table:

{table name}[{row number}].{subtable name}.{column name}.

Parameter

Data Type

Description

1

Text

First name of a table field

2

(variable)

Value of first table field

n-1

Text

Last name of a table field

n

(variable)

Value of last table field

Examples

AddLineItem("Items.Field1", "ABC", "Items.Field2", 123) appends a line to the Items table and assigns values to the Field1 and Field2 table fields.

AddLineItem("Items.LineNo", LineItemCount("Items") + 1) adds an almost empty row to the Items table, in which only the LineNo field is pre-filled with the linenumber. The line number is calculated by incrementing the current number of lines in the target table.

AggregateLineItems()

This function aggregates the values of groups of rows to be formed in an index data table to a single row each. Aggregation is performed separately by field across all rows in a group, and only elementary data types are supported. The parameter list is of variable length and, starting from the third position, consists alternately of the full name of a table field to be aggregated as defined in the field catalog (i.e., {table name}.{column name}), and the aggregation mode (see below). If an existing table field is not listed in the process, only its value will be implicitly taken from the first row of the group.

Sub-tables can also be addressed, but then always specify the number of a concrete, already existing row for the parent table:

{table name}[{row number}].{subtable name}.{column name}.

Parameter

Data Type

Description

1*

Text

Mode defining the formation of groups of lines, each of which is to be combined into one line:

  • FixedLineNo: a fixed number of consecutive lines form a group

  • StartCondition: consecutive lines form a group

    Which line represents the beginning of a new group is determined by a content-based condition.

  • EndCondition: consecutive lines form a group

    Which line represents the end of the current group is determined by a content-based condition.

  • RepeatCondition all lines that have a certain identical property value are grouped together, regardless of their order

2*

(variable)

Macro expression which, depending on the mode defined in the previous parameter, must return the condition or value on the basis of which the grouping is performed

The macro is executed by line – except for the FixedLineNo mode – and should use field variables that refer to the table fields.

  • For FixedLineNo: a numeric value of the fixed number of lines per group

  • For StartCondition and EndCondition: a Boolean value determining whether the current line represents the beginning or the end of a group, respectively

  • For RepeatCondition: a value of arbitrary type, which must be the same for each related row

3

Text

First name of a table field to be aggregated

4

Text

Mode defining how the values of the table field mentioned before are aggregated:

  • First: only the value from the first line of the group is adopted.

  • Last: only the value from the last line of the group is adopted.

  • Array: the values are combined to form an array.

  • Join or Join[{delimiter}]: The values are combined to form a delimited string. Typed values are converted to the internal string notation. You can choose which delimiter is used (default value: comma).

  • And or Or: The values are linked as Boolean values with AND or OR. If a value cannot be interpreted as a Boolean value, the value will implicitly be set to FALSE.

  • Sum or Avg: The sum or average value is calculated numerically for the values. If a value cannot be interpreted as a numerical value, it will implicitly be set to 0.

n-1

Text

Last name of a table field to be aggregated

n

Text

Mode defining how the values of the table field mentioned before are aggregated

Examples

Atable might include the following fields and values:

LineItems.KeyField

LineItems.Field_A

LineItems.Field_B

LineItems.Field_C

"Key1"

"A1"

"B1"

1

"Key2"

"A2"

"B2"

2

"Key1"

"A3"

"B3"

3

"Key2"

"A4"

"B4"

4

When this macro expression is executed, lines 1 and 3 and lines 2 and 4 are combined as follows:

AggregateLineItems("RepeatCondition", @LineItems.KeyField, "LineItems.Field_A", "Array", "LineItems.Field_B", "Join", "LineItems.Field_C", "Sum")

LineItems.KeyField

LineItems.Field_A

LineItems.Field_B

LineItems.Field_C

"Key1"

["A1","A3"]

"B1,B3"

4

"Key2"

["A2","A4"]

"B2,B4"

6

ClearLineItems()

This function deletes all existing rows from an index data table.

Parameter

Data Type

Description

1

Text

Name of the table in question (i.e., the name part used in the field catalog of table fields for the parent table) (optional)

If the name is not specified, the first table present in the document is used.

Examples

ClearLineItems("Items") clears the Items table.

ForEachLineItem()

This function runs in a loop over all rows of an index data table, executing a macro expression in the context of the respective row. Optionally, the execution can be bound to a condition.

Parameter

Data Type

Description

1*

Text

Name of the table (i.e., the name portion used in the field catalog for table fields for the parent table)

2

Bool

Boolean value determining whether for a line the macro will actually be executed (preferably in the form of a dynamic macro expression) (optional)

3*

(None)

Macro expression executed for a table row

A possible return value of the macro is not evaluated. Instead, the expression is to be formulated in the form of an assignment to change values in the relevant line or in the header data.

Examples

A table has the following fields and values. There is a header data field called "Sum," with an initial value of 0.

LineItems.Field_A

LineItems.Field_B

LineItems.Field_C

"A1"

"B1"

1

"A2"

"B2"

2

The following macro expression executes 2 different actions per line, combined as a block. The value in the second table field is changed and the values of the third table field are summed up in the header data field "Sum".

ForEachLineItem("LineItems", , { @LineItems.Field_B = @LineItems.Field_B + "!"; @Sum = @Sum + @LineItems.Field_C })

As a result, the new values of the second table field and the header data field are "B1!", "B2!", and 3.

RemoveLineItems()

This function deletes certain rows from an index data table.

Parameter

Data Type

Description

1

Text

Name of the table in question (i.e., the name part used in the field catalog of table fields for the parent table) (optional)

If the name is not specified, the first table present in the document is used.

2*

Bool

Macro expression that is executed by table row and must return a Boolean value determining whether the row in question is to be deleted

The macro expression should use field variables that refer to the table fields.

Examples

RemoveLineItems("Items", IsEmpty(@Items.Field1)) deletes all lines from the Items table in which the Field1 field is empty.