Skip to main content
Create and edit a Record object and write your changes to the MI server. This notebook describes how to edit text-based attributes. See the following notebooks for additional attribute types:

Connect to MI

Get a database and table.

Create a new record and path

Create a path in the table from a starting folder, in this case, the top level folder, using path_from(). Specify end_node to create a new Record object at the end of the path with that name.
Previous cell output:

Edit the record’s attributes

Get some attributes associated with the record.
Edit their data values.
Statistical Basis is a single valued discrete attribute, and must be set with a string.
Previous cell output:
Available mechanical properties is a multivalued discrete attribute. It can be set either with a string or a list of strings for each value.
Previous cell output:

Set the record’s release status

If the record is being created in a version-controlled table, decide whether the record should be released after creation. The record is created in the unreleased state to allow more data to be added later without creating a new version.

Write your changes to MI

First, specify the attributes on the record which you want to update on the server.
Then write the changes to MI. The list of updated Record objects is returned.
Previous cell output:

‘Not Applicable’ flag

Further edits can be made to the same Record object. In this case, the Condition attribute is not relevant, so the is_applicable property is set to False. This sets the attribute to ‘Not Applicable’ in Granta MI.
Set the new attributes to update, and update again to write the latest changes to the server. Release the record.
Previous cell output:
Check the Record.all_versions property for a dictionary of all versions of the record. The dictionary contains a single version, confirming that only a single version was created in Granta MI.
Previous cell output:

Meta-attributes

Meta-attributes are edited similarly to attributes, except that meta-attributes are a property of the parent attribute, as opposed to the table. It is strongly recommended to ensure the parent attribute has a value if the meta-attribute is being set; the behavior of a populated meta-attribute with an empty parent attribute is undefined. If the parent attribute doesn’t already have a value, set the parent attribute value.
Mooney-Rivlin is a logical attribute. It is set to a Python boolean value.
Now set the meta-attribute value.
Finally, set both the attribute and meta-attribute to update, and update the record.
Previous cell output:
Check the Record.all_versions property again. The dictionary contains two versions, confirming that updating the Mooney-Rivlin attribute has created and released a second version of the record.
Previous cell output:

Output the record’s attributes

The attribute values are accessed via the same properties used for assignment. Statistical Basis and Available mechanical properties are discrete attributes. For multivalued discrete attributes the value is a list of strings, otherwise the value is a string. Condition is set to ‘Not Applicable’; this is checked when printing the attribute value.
Previous cell output: