MMpy.File.set_field_value
Syntax
file.set_field_value(field_id, record_id, value)
Description
Assign a string or a numeric value to a record field identified by the given field ID and record ID.
Parameters
Name |
Type |
Description |
---|---|---|
field_id |
int | The ID of the target field. |
record_id |
int | The ID of the target record. |
value |
float or str | The value to assign to the record field. |
Returns
Type |
Description |
---|---|
bool | Returns True if the value was successfully set, otherwise returns False. |
See Also
MMpy.File.get_num_field_value()
MMpy.File.get_str_field_value()
Notes
Record IDs are 1-based, meaning passing an index of 1 will return the first record.
Examples
file_path = MMpy.Project.path() + 'Test.DAT' file = MMpy.File() file.open(file_path) num_field = 'NUMVALUE' num_field_id = file.get_field_id(num_field) str_field = 'STRVALUE' str_field_id = file.get_field_id(str_field) file.set_field_value(num_field_id, 1, 0.5) file.set_field_value(str_field_id, 1, 'A string value') file.close()
Resource ID
IDPH_FILE_SET_FIELD_VALUE