MMpy.File.structure

Syntax

file.structure

Description

Property to read or modify the structure of a data file.

Parameters

Type
Description
MMpy.FileStruct Assign a new structure to the data file.

Returns

Type
Description
MMpy.FileStruct Returns the structure object of a file

Notes

This is a read/write property.

Be careful when modifying a structure of an existing file with data in it! A best effort attempt at preserving the data will be made, but cannot be guaranteed. For example, changing the field type may result in all values being erased from that column, such as going from a character field to a real field.

For special requirements of copying data, the user will need to programmatically do it themselves.

Examples

out_path = MMpy.Project.path() + 'Out.DAT'
out_title = 'OutData'

file = MMpy.File()

# Create a new data file from a template.
file.open(...)
MMpy.File.create_from_template(out_path, out_title, file.structure)
file.close()

# Modify the structure of the new file.
file.open(out_path)
structure = file.structure
structure.add_field(...)

# Set the structure of the new file.
file.structure = structure

# Continue using the new file.
file.set_field_value(...)
file.close()

Resource ID

IDPH_FILE_STRUCTURE