# Subtable: Editable part of an array

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The purpose of SubTable is to provide the user an alternative editable view of part of an edit table. If a variable «a» is defined as an edit table, a variable «b» defined as SubTable(a[i = x]) lets the user use u to view and edit a subarray of «a», for which index «i» of «a» has value «x». Any change you make to cells of «b» is reflected in «a», and vice versa. The actual values are stored in edit table «a».

SubTable(a[i = x]): A subtable can also show subarrays of «a» in a different order, if «x» is an array containing some or all values of «i» in a different sequence. «b» can also use different number formats.

A subtable also works if «a» is defined using any editable table functions, including edit table (Table()), probability table (ProbTable()), deterministic table (DetermTable()), or even another subtable.

SubTable() must be the main expression in the definition of a variable. It cannot be a subexpression or inside a function. Its parameter must be a slice or subscript operator. For example, in the simplest form:

SubTable(a[i = x])

where «x» is an element of index «i» and «x» is a value of «i». Many other variations are also useful including:

SubTable(a[i = x])
SubTable(a[i = x, j = y])
SubTable(a[i = b])
SubTable(a[@i = c])

If the subarray returned by Subtable() is an atom (i.e., a single value with no indexes), you can edit it in a table view, or, if you define an input node for it, directly as an input field.