Skip to main content

TableValue

The TableValue function returns the value of a specific column inside a Table.

Prototype

    TableValue(Table ; ColumnName ; Where ; OrderBy)

Arguments

    Table             String      By value   

Contains the variable of type table or a valid string containing the name of an AF table
or an attribute value of type data table.

ColumnName String By value

A valid string containing the name of a column.

Where String By value

(Optional)
A valid string containing a Where Clause (C# DataTable select format).
Where parameter can be empty.

OrderBy String By value

A valid string containing one or more column names, comma separated.

OrderBy can be empty.

Returns

  Value 

The selected column value, the result type will be inherited from the column data type.

Exception

    Undefined

Undefined is returned if:

- TableName is empty, or Undefined or not a valid String
- ColumnName is empty, or Undefined or not a valid String or the Column does exist
- Where is not a valid SQL statement
- OrderBy is not a valid SQL statement

Examples

    TableValue('SF_Component table' ; 'ApparentDensity' ; 'Component='C6+' ; )

This will return the first occurrence value of the [ApparentDensity] column from the AF Table [SF_Component] column is equal to the string value ['C6+'].

    TableValue("i_CompositionTrackingResults"; 'Density'; 'Material='C3'; )

This will return the first occurrence value of the [Density] column from the data table recorded in the [i_CompositionTrackingResults] attribute where the [Material] column is equal to the string value ['C3'].