FieldValueExporter¶
-
MacroModule
¶ author Wolf Spindler
package FMEstable/ReleaseMeVis
definition FieldValueExporter.def see also SettingsManager
keywords expoprt
,save
,value
,file
,save
,store
,write
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.
Parameter Fields¶
Field Index¶
Auto Increment : Bool |
Remove File : Trigger |
Auto Save : Bool |
Save : Trigger |
Error Log Mode : Enum |
Status : String |
Field Value : String |
Succeeded : Bool |
Index : Integer |
Use Indexing : Bool |
Named Field Value : String |
Value To Write : Enum |
Output File Name : String |
Write Mode : Enum |
Parent Levels Up : Integer |
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 Up
should 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 Value
or the value of the field referenced withNamed Field Value
shall be written.
Values:
Title | Name | Description |
---|---|---|
Named Field Value | namedFieldValue | The value of the field named in Named Field Value is written to file. |
Field Value | fieldValue |
Named Field Value¶
-
name:
namedFieldValue
, type:
String
¶ If
Value To Write
is 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 Write
is not namedFieldValue.
Field Value¶
-
name:
fieldValue
, type:
String
¶ If
Value To Write
is fieldValue then the value ofField Value
is written to file. The value of this field is ignored ifValue To Write
is 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 Indexing
is on this value is inserted as index in the file name (before the suffix); it is insensitive and unused ifUse Indexing
is off.
Use Indexing¶
Auto Increment¶
Auto Save¶
-
name:
autoSave
, type:
Bool
, default:
FALSE
¶ If checked then any change of
Named Field Value
orField Value
implicitly touchSave
. If not checked thenSave
must be touched to write any value to file. Note that only changes ofNamed Field Value
itself 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
Save
ifAuto Increment
is checked. This is becauseSave
implicitly 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 Write
in the file. The file name is built according to the settings ofOutput File Name
,Index
andUse Indexing
.