Math Reference Support

TableView supports cell math references in a Templex expression, like the support of curve math references in HyperGraph.

Math References Format

The format for these references is:

p<page_number>w<window_number>_<row_number><column_number>

For example, when referencing the B5 table cell in window 1 of page 4, the reference would be "p4w1_B5".

TableView Cells with Templex Expressions

TableView supports the evaluation of Templex expressions in cells which begin with an equal sign, =. The Templex expressions after the “=” are automatically evaluated and can return strings, scalars and vectors. This means that if you define a Templex entity from type scalar, vector, or string, the same entity type needs to be returned from the cell math reference anywhere in HyperWorks Desktop.
Note: Multiline is not supported for these cells.

String (text) cells which have no leading "=" sign contain strings. They can contain both numeric, alphabetic, and other characters. Templex expressions inside these cells are only evaluated if they are in curly braces, {}.

Example 1

To add two cells A1 and A2 in cell A3, enter:
=A1+A2
Figure 1.


Example 2

Scale curves in page 1, window 1 with cell values from page 1, window 2.

The cell A1 contains "4".

The expression "=typeof(a1)" in cell a2 displays "1", which means the content of cell A1 is a scalar.

The expression "=4*a1" in cell a3 displays "16".

The y vector expression curve p1w1c2 is "p1w2_a1*p1w1c1.y" and scales the curve by a factor of 4.

Example 3

Refer to a vector element in cell A2 from a vector defined in cell A1.

The vector in cell a1 is defined using the Templex expression "=1:5:1".
  • The Templex expression in cell A1 using "=1:5:1" defines a vector.
  • Cell A1 displays "1,2,3,4,5".
  • The expression "=A1" in cell A2 also displays "1,2,3,4,5".
  • The expression "=typeof(A1)" in cell A3 displays w 2, which means the content of cell A1 is a vector.
  • The expression "=A1[2]" in cell A4 returns "3", the third element of cell A1.
Figure 2.


Example 4

String addition.
  • cell A1 contains the string "Demo".
  • cell A2 contains the string "Text".
  • The expression =a1+ " " +a2 in cell A3 returns "Demo Text".
Figure 3.