MultiTable
Note: The MultiTable is an experimental feature introduced in Analytica 4.5. It is not full exposed yet as of Analytica 4.5, and because it is experimental, it could be subject to change in the future.
MultiTable(i1,i2,...)(src1, src2, ...)
A MultiTable provides a unified virtual view of multiple sources of data in a single edit table. The sources can consist of both editable tables and computed non-editable results, both depicted within the cells of a single table. When you change a cell, you are actually changing the original cell in the source, not a copy.
Best practice in Analytica modeling is generally to keep different types of information in different variables; however, you may want to present an end-user with a unified table view, with different columns depicting different items. The MultiTable gives you a way to provide such a view without sacrificing the desired practice of keeping separate data items separate.
For example, suppose Startup_cost
and Probability_success
are both edit tables, indexed by Project
. Then the MultiTable defined as:
MultiTable(Item)(Startup_cost,Probability_success)
displays both in the same edit table, indexed by Item
and Project
, and the user can edit either item directly from this view.
MultiTable is the inverse of SubTable in that MultiTable unifies multiple sources into one view, whereas SubTable is used to view or reorganize a single source.
Changing a MultiTable definition
Once you define a MultiTable, an edit table button appears in the definition field, and when you view it, you see the source content. The MultiTable definition itself is a meta-level description of the content. To get at this meta-level definition once it has been entered, you must edit the definition of the variable as a textual expression. You can do this either from the Attribute Panel or Object Window by selecting expr in the definition-type selector.
Displaying editable cells
To display the cells of another table, or the definition of a scalar variable, simply enter the identifier of that variable as the meta-cell source, e.g.
MultiTable(Item)(A,B)
You can also enter a Subscript or Slice expression in the cell -- the same set of expressions accepted by the SubTable function, to depict (or re-arrange) a subset of data from the original source, e.g.:
MultiTable(Item)(A[Project=SortedProject],B[Project=SortedProject])
Source tables that are Subscripted or Sliced along table indexes are depicted as editable cells.
In browse mode, data is only editable if it is associated with an input node. This means that if your MultiTable variable has an input node, then all table sources can be changed from browse mode (and thus, from Analytica Player or Cloud Player). Otherwise, if one source has an input node and another does not, then the cells corresponding to the source with the input node can be changed, while those corresponding to the other source cannot be changed from browse mode.
Displaying computed results
Computed results can be included in the same table. Cells that are computed cannot be edited, but they can sit side-by-side with editable cells. The computed values are allowed to depend on editable sources that are also depicted. Computed values are refreshed when you press the Green check button for the table.
When you enter an expression other than an identifier or a Subscripted/Sliced table, the expression is evaluated and the computed value is displayed in a read-only form. Some examples of computed sources are:
Mid(X)
: computes and displays the mid-value of XAbs(X)
: displays the absolute value of the (mid-value) of XMean(X)
: computes and displays the mean of X1.2
: displays the number, 1.2, in a non-editable cell"Some text"
: displays the text, without quotes, in a non-editable cell
Here is an example of an editable value and computed value in the same table: Index Base := ["Decimal", "Hex"] Variable x := 123 Variable HexConverter := MultiTable(Base)(x,NumberToText(x,"Hexadecimal"))
The edit table displays like this:
The first cell can be edited, and when you change it and press the green check, the Hex value is computed and displayed.
Dimensionality
The dimensions of the MultiTable content are the union of the indexes from all sources and of the MultiTable index(es).
A MultiTable works best when your sources all have the same dimensionality. When one source does not have an index present in another source, a single cell in the source will map to multiple cells in the MultiTable; hence, you'll see the same value multiple places, and when you change it, multiple cells will change. The source retains its original dimensionality, so if the value doesn't vary along an index in the source, it won't vary along that index is the MultiTable. You may temporarily see a difference in these cells after you first enter a value, but they will become consistent as soon as you press the Green check.
Number Formats
TBD
Units
TBD
Enable comment auto-refresher