FieldValueExporter¶
- MacroModule¶
 author
package
definition
see also
keywords
Purpose¶
FieldValueExporter is a convenience macro to save the value of a field in a file.
The field whose value to export can be specified either via a field (connection) or with a name of a module plus field name like in a ctx.field() statement. Thus even fields deep inside of modules can be referenced without the need of field connections which may not be possible always.
The exported values can either be written or appended to the file such that normal file export as well as log file handling is supported. Of course automatic exports on field changes are possible, too.
The output file can be specified as a file name, can be extended with a (counted) index and the currently specified file also can be removed easily. Error state information is logged with a success flag, a status field as well as configurable ML error logs.
FieldValueExporter is especially useful for application builders to reduce the need for script code in situations where field values have to be exported as files or if log files shall be created.
Windows¶
Default Panel¶
Parameter Fields¶
Field Index¶
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
Visible Fields¶
Parent Levels Up¶
- name: parentLevelsUp, type: Integer, default: 0, minimum: 0¶
 Specifies the number of network levels to go up before searching field values. This is needed to use FieldValueExporter in internal networks of macro modules. Fields typically shall be searched in the network in which the macro module is instantiated and not in the internal network of the macro itself. In such cases
Parent Levels Upshould be 1 instead of the 0. When using it in an internal network of a macro in an internal network then use 2 etc.
Output File Name¶
- name: outputFileName, type: String¶
 The full file name of the file to be stored including directory path and suffix.
Value To Write¶
- name: valueToWrite, type: Enum, default: namedFieldValue¶
 Determines whether the value of
Field Valueor the value of the field referenced withNamed Field Valueshall be written.
Values:
Title  | 
Name  | 
Description  | 
|---|---|---|
Named Field Value  | 
namedFieldValue  | 
The value of the field named in   | 
Field Value  | 
fieldValue  | 
Named Field Value¶
- name: namedFieldValue, type: String¶
 If
Value To Writeis namedFieldValue then the value of the field described in this field is written to file. The field whose value shall be written is described case sensitively like in the ctx.field() syntax, such as LocalImage.name or View2D.ext.sliceZoom.min or so. The value of this field is ignored ifValue To Writeis not namedFieldValue.
Field Value¶
- name: fieldValue, type: String¶
 If
Value To Writeis fieldValue then the value ofField Valueis written to file. The value of this field is ignored ifValue To Writeis not fieldValue.
Write Mode¶
- name: writeMode, type: Enum, default: create¶
 The way how the field value is written into the file.
Values:
Title  | 
Name  | 
Description  | 
|---|---|---|
Create  | 
create  | 
Writes the value to a newly created file. If another one with the same name exist it will be overwritten silently.  | 
Append  | 
append  | 
If the file exists then the value is appended, otherwise the file is created and the value is written into it.  | 
Error Log Mode¶
- name: errorLogMode, type: Enum, default: logAllFailures¶
 Controls whether and when the module logs ML errors on failures.
Values:
Title  | 
Name  | 
Description  | 
|---|---|---|
Log Nothing  | 
doNotLog  | 
No error or failure causes any ML error log.  | 
Only Save Failures  | 
logOnlySaveFailures  | 
Only failures of save operations are logged as ML error.  | 
All Failures  | 
logAllFailures  | 
Any failures are logged as ML error.  | 
Index¶
- name: index, type: Integer, default: 0, minimum: 0¶
 If
Use Indexingis on this value is inserted as index in the file name (before the suffix); it is insensitive and unused ifUse Indexingis off.
Use Indexing¶
Auto Increment¶
Auto Save¶
- name: autoSave, type: Bool, default: FALSE¶
 If checked then any change of
Named Field ValueorField Valueimplicitly touchSave. If not checked thenSavemust be touched to write any value to file. Note that only changes ofNamed Field Valueitself are observed for modifications, and not the field referenced by it.
Remove File¶
- name: removeFile, type: Trigger¶
 Removes the current file if it exists and resets succeeded state to off. Note that remove usually does not work after
SaveifAuto Incrementis checked. This is becauseSaveimplicitly increases the index for the file name and the export file name then does not match the recently written file any more.
Save¶
- name: save, type: Trigger¶
 Stores the value of the field described with
Value To Writein the file. The file name is built according to the settings ofOutput File Name,IndexandUse Indexing.
Succeeded¶
Status¶
- name: status, type: String, persistent: no¶
 Shows information about the most recent operation.