TSTool / Command / ReadPropertiesFromFile
Overview
The ReadPropertiesFromFile
command reads the values of one or properties from a file,
which can then be used in workflows using ${Property}
syntax.
The corresponding WritePropertiesToFile
command can be used to write properties to a file.
Processor properties include built-in global defaults such as InputStart
, InputEnd
,
OutputStart
, OutputEnd
, OutputYearType
, WorkingDir
,
and also user-defined properties set with the SetProperty
command.
Internally, properties have a name and a value, which is of a certain type
(string, integer, date/time, etc.). Examples of using the command include:
- creating tests to verify that properties are being set
- passing information from TSTool to another program, such as a Python script
- storing persistent information for later use, such as the date/time that data were last downloaded from a web service
- reading text from a file to merge into a file
A number of property formats are supported as listed in the following table.
Property File Formats
Format | Description |
---|---|
NameValue |
Simple format, all properties handled as text:PropertyName=PropertyValue PropertyName="Property value, quoted if necessary" |
NameTypeValue |
Same as NameValue format, with non-primitive objects treated as simple constructors:PropertyName=PropertyValue DateTimeProperty=DateTime("2010-10-01 12:30") |
NameTypeValuePython |
Similar to the NameTypeValue format; however, objects are represented using “Pythonic” notation, to allow the file to be used directly by Python scripts:PropertyName="PropertyValue" DateTimeProperty=DateTime(2010,10,1,12,30) |
Value |
Read the entire contents of a file into a property. |
The command attempts to create objects of the proper type but if this is an issue, it may be necessary to use the formats that include property type.
Command Editor
The following dialog is used to edit the command and illustrates the command syntax.
ReadPropertiesFromFile
Command Editor (see also the full-size image)
Command Syntax
The command syntax is as follows:
ReadPropertiesFromFile(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
InputFile required |
The property file to read, as an absolute path or relative to the command file. Can be specified using ${Property} . |
None – must be specified. |
FileFormat |
Format of the properties file (see descriptions in the above Property File Formats table):
|
NameValue |
IncludeProperty |
The names of properties to read, separated by commas. Can be specified using ${Property} . |
If not specified, all processor properties will be written. |
Examples
See the automated tests.
Troubleshooting
See Also
SetProperty
commandSetPropertyFromTimeSeries
commandWritePropertiesToFile
command