MultiTable: Combining editable and computed arrays
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.
In the MultiTable shown here, data from four separate edit tables, all indexed by
Contact_num, are depicted along with two computed columns. The computed columns have a gray background.
A MultiTable has two different table views, called the cell view and the meta view. The cell view shows the data, whereas the meta view shows the expressions that determine where the data comes from. The meta view corresponding to the previous table is the following.
Stock_price_lookup is a user-defined function.
Creating a MultiTable: Before configuring a MultiTable, you’ll need one or more indexes for the table. These are the indexes over which the specification of where the data comes from changes. The preceding example has a single table index,
Option_field, with each column of the cell view using a different source.
Create a variable to hold your MultiTable and press Ctrl+E to place your cursor in the Definition field. On the definition type pulldown, select Other..., and from the Function Finder select the Array library. Scroll down to find and select MultiTable and press the Indexes button. From the index chooser, select the index or indexes that your data source will vary over. You should not include the indexes of your data sources here. Once you press OK, you’ll be presented with an empty table in meta view.
Meta expressions: Each cell in meta view specifies either an editable data source or a computed expression.
To specify an editable source, enter the identifier of the source variable. The source variable can be an edit table, a SubTable', another MultiTable, or a scalar variable. When the source is a nontable, its definition will show in the cell.
To specify that the computed result of a given variable should displayed, enter
Mid(X) as the meta expression, substituting the identifier of your variable for
You can also pull an editable slice of a source table, rather than the whole table, by specifying a slice or subscript expression, such as
X[I = v].
In addition to these cases, you can enter an arbitrary expression, which is evaluated and shown as a computed result. Literals, including numbers and quoted text, are treated as computed values and are shown as non-editable cells.
Source dimensionality: MultiTables work best when all sources and computed expressions have the same dimensionality. The cell view has the union of all source indexes along with the meta table indexes. If a source lacks an index present in other sources, then the same source cell is depicted multiple times.
Computed cells: Computed expressions can depend on editable sources that appear in other columns. When a MultiTable is configured in this fashion, changing the input cells causes the computed cells to change. The re-computation takes place when you press the green check button.
Browse-only editing: The general rule throughout Analytica is that a variable or table cannot be edited in browse mode unless it has an input node. If you distribute a browse-only copy of your model to others, or if someone uses it from the Power Player or Analytica Cloud Player, these are the only inputs the user can change. In the case of a MultiTable, if the MultiTable variable has an input node then all non-computed cells can be changed. Otherwise, only the cells corresponding to sources having an input node can be changed.
Enable comment auto-refresher