MultiTable

Revision as of 23:58, 29 March 2013 by Drice (talk | contribs) (Initial cut)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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, one often wants to present an end-user of a model 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.

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 X
  • Abs(X) : displays the absolute value of the (mid-value) of X
  • Mean(X) : computes and displays the mean of X
  • 1.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:

HexConverter.png

The first cell can be edited, and when you change it and press the green check, the Hex value is computed and displayed.

Comments


You are not allowed to post comments.