Skip to main content
Work with linked tabular data, including how to access linked data within linked rows. In general, tabular attributes contain a combination of local and linked tabular columns. This example focuses on linked tabular rows and columns only. Example 11 shows how to work with local tabular data.

Access an existing record

Connect to MI and specify a database and table.
Access an existing record by path.
Previous cell output:

Access a linked tabular attribute

Access the tabular attribute Tensile test data used in this rollup.
Previous cell output:
The tabular attribute __repr__ shows that the tabular attribute is not loaded yet, and so additional information about the number of rows and columns is not available. Tabular data is loaded on-demand to improve performance, and reading or modifying the data will load the data automatically. However, accessing the __repr__ does not trigger the load operation. To load the data manually, use the .load() method. Once the attribute is loaded, the __repr__ shows the number of rows and columns.
Previous cell output:
The .column_name, .column_types, and .linked_columns properties list the tabular column names, types, and whether the column is linked. Each of these properties contain 8 entries, which corresponds to the number of columns in the tabular attribute, and the size printed in the tabular attribute __repr__.
Previous cell output:
The .value property contains an immutable representation of the current state of the tabular attribute value. This property is useful as a high-level summary of the data, but should not be used for processing. The .rows property described in the next section provides a richer representation of the data.
Previous cell output:
The .linking_table and .linking_attribute properties contain the target table and target attribute. This is a linked tabular attribute, so these properties return Table and AttributeValue objects respectively.
Previous cell output:

Tabular rows

The .rows property lists all rows. There are 9 TabularRow objects shown, which corresponds with the size printed by the tabular attribute __repr__.
Previous cell output:
Each individual tabular row __repr__ contains the linking value and the row ID.
Previous cell output:
The linked records themselves are available by accessing the AttributeTabular.linked_records property. This returns a dictionary mapping the linking value to the list of resolved records in the target table. Each row has a single linking value, but in general a linking value may match zero or more records. In this example, each linking value matches one record.
Previous cell output:

Tabular cells

The cells are available as a tuple of cell values via the .cells property, or by their column name via the .cells_by_column property.
Previous cell output:
Previous cell output:
Each cell in a linked tabular column is represented as a tuple of value objects. This is because each tabular row may link to zero or more records, and the target attribute may or may not be populated for each record. Tabular cell classes have similar interfaces to their attribute value counterparts. For example, all tabular cell classes have a .value property, and picture and file tabular cell classes have a .save() method. Linked tabular cell value objects differ from their local tabular cell value equivalents in that they are read-only. Local tabular cell values are shown in the local tabular data example referenced in the introduction. Short text cells have a .value property:
Previous cell output:
Attempting to modify the value of a linked tabular cell value raises an AttributeError:
Previous cell output:
Point cells have a .value and a .unit property:
Previous cell output:
Empty linked cells are represented as an empty tuple.
Previous cell output:

Add a linked row

The .append_row() method accepts an optional argument to specify a linking value. The cell below creates a row which link to all records in the target table with the value L14L12HIP1T in the target attribute.
The new row’s __repr__ shows the linking value.
Previous cell output:
However, the row does not contain any linked data until the row is imported and the tabular attribute is refreshed.
Previous cell output:
Write the changes to the server.
Check the content of the tabular attribute after the update. The linked row now contains values in the populated linked columns.
Previous cell output:

Add a local row

The .append_row() linking_value argument is optional. The cell below creates a local row, which will not contain any linked data.
The new row’s __repr__ shows the lack of linking value.
Previous cell output:
Write the changes to the server.
Check the content of the tabular attribute after the update. This row is not linked and there are no local columns in the tabular attribute, so all cells are empty.
Previous cell output:

Delete rows

Delete rows by specifying the row index to delete. Use the length of the .rows tuple to get the number of rows, and delete the last two.
Previous cell output:
Write the changes to the server, and check the content of the tabular attribute after the update.
Previous cell output: