Skip to content

StateDMI / Command / WritePropertiesToFile


Overview

The WritePropertiesToFile command writes the value of one or more processor properties to a file (this command replaces the older WriteProperty command, which is being phased out). The ReadPropertiesFromFile command can be used to read properties from a file. Processor properties include built-in properties such as InputStart, InputEnd, OutputStart, OutputEnd, OutputYearType, WorkingDir, and also user-defined properties set with SetProperty and other commands. Internally, properties have a name and a value, which is of a certain type (Boolean, 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

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)

Command Editor

The following dialog is used to edit the command and illustrates the command syntax. See also the full-size image.

WritePropertiesToFile

WritePropertiesToFile Command Editor

Command Syntax

The command syntax is as follows:

WritePropertiesToFile(Parameter="Value",...)

Command Parameters

Parameter                           Description Default          
OutputFile
required
The property file to write, as an absolute path or relative to the command file, can use ${Property}. None - must be specified.
IncludeProperties The names of properties to write, separated by commas. The * wildcard can be used to indicate multiple properties. If not specified, all processor properties will be written.
WriteMode Indicates how the file should be written:
  • Append – append the properties to the file without checking for matches (create the file if it does not exist)
  • Overwrite – overwrite the properties file
  • Update – update the properties in the file by first checking for matching property names (which will be updated) and then appending unmatched properties (not yet implemented)
Overwrite
FileFormat Format of the properties file (see descriptions in the above Property File Formats table):
  • NameValue
  • NameTypeValue
  • NameTypeValuePython
NameValue
SortOrder The order to sort properties:
  • Ascending
  • Descending
  • None
None – order depends on order in processor.

Examples

See the automated tests.

Troubleshooting

See Also