Table References: Difference between revisions

From Planimate Knowledge Base
Jump to navigation Jump to search
m (First Cut)
 
mNo edit summary
 
Line 3: Line 3:
The MATCHED CELL attref mode enables dynamic location of rows and columns in a table, rather than using direct indexing.<br>Its intended that these MATCH modes are used where its assumed all expected keys/labels will be in the table, and the labels will be changing order meaning row order cannot be relied upon. Performance will be slower than using CELL and ROW due to the search so only use where label lists are changing and the tables cannot be kept in index order.
The MATCHED CELL attref mode enables dynamic location of rows and columns in a table, rather than using direct indexing.<br>Its intended that these MATCH modes are used where its assumed all expected keys/labels will be in the table, and the labels will be changing order meaning row order cannot be relied upon. Performance will be slower than using CELL and ROW due to the search so only use where label lists are changing and the tables cannot be kept in index order.


=== Matched Cell ===
=== Matched Cell ===


Instead of addressing a table by Row/Col, one specifies<br>Key Column<br>Column<br>Key Value<br>For the row, the Key Column column is searched for the specific value Key Value. <br>This match is *by value* so its important that the format of the key column and key value be the same (i.e. same label list)<br>The match is the row which will be used to address the table. If the match fails, an error occurs.<br>When the match is found, that row is used to address the cell at column Column.
Instead of addressing a table by Row/Col, one specifies<br>
 
*Key Column
*Column
*Key Value
 
For the row, the Key Column column is searched for the specific value Key Value. <br>This match is *by value* so its important that the format of the key column and key value be the same (i.e. same label list)<br>The match is the row which will be used to address the table. If the match fails, an error occurs.<br>When the match is found, that row is used to address the cell at column Column.


=== Matched Column ===
=== Matched Column ===

Latest revision as of 14:52, 3 October 2008

Matching Cells Rows and Columns

The MATCHED CELL attref mode enables dynamic location of rows and columns in a table, rather than using direct indexing.
Its intended that these MATCH modes are used where its assumed all expected keys/labels will be in the table, and the labels will be changing order meaning row order cannot be relied upon. Performance will be slower than using CELL and ROW due to the search so only use where label lists are changing and the tables cannot be kept in index order.

Matched Cell

Instead of addressing a table by Row/Col, one specifies

  • Key Column
  • Column
  • Key Value

For the row, the Key Column column is searched for the specific value Key Value.
This match is *by value* so its important that the format of the key column and key value be the same (i.e. same label list)
The match is the row which will be used to address the table. If the match fails, an error occurs.
When the match is found, that row is used to address the cell at column Column.

Matched Column

If in the above reference, am attribute formatted to a label list is assigned to the Column parameter, the system will attempt a further match to determine the column index to be used.
A string match is sought between the table’s column label and the label of the attribute addressing the column. In effect it implements a mapping between a label list (e.g.: _Model Objects) and the column labels of the table. If the label is not located in one of the table columns, an error occurs.
If the Column attribute is not formatted for labels, its treated as a normal index, and no match is sought.

COLUMN INDEX

In this Attribute referencing mode, a model can determine the index of a column label selected from that table, by matching a label name to the column name. If a label matches any column of the table, the index of the column is returned.
If there is no match, the system returns a 0 without causing a run time error. This can be used to validate the existence of a column in a table before committing to a matched cell lookup.

MATCHED ROW

Instead of specifying a row directly, one specifies Key Col and Key Value,
The Key Col column is searched for the value Key Value and that row is then the target row for the operation

Cautions

In both the Matched Cell and Matched Row cases, if more than one row matches Key Value then any row index may be returned - there is no preference or default available.
If no rows match "Key Value" then the model stops with an error.