TSTool / Command / SetPropertyFromObject
Overview
The SetPropertyFromObject
command sets the value of a property used by the time series processor
by copying a property from an object.
Typical uses of the command are:
- Use a JSON file to provide configuration properties to a workflow.
- Check whether an input JSON file contains expected properties.
Command Editor
The command is available in the following TSTool menu:
- Commands / Object Processing
The following dialog is used to edit the command and illustrates the command syntax for general parameters.
SetPropertyFromObject
Command Editor (see full-size image)
The object property name (ObjectProperty
) is specified using a period-delimited string,
with periods used to separate object levels.
Currently, properties can only be set from single object properties, not from a property in an array. This functionality may be added in the future.
Command Syntax
The command syntax is as follows:
SetPropertyFromObject(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
ObjectID required |
The identifier for the object containing the property to provide the value. | None - must be specified. |
ObjectProperty required |
The object's property name, specified using periods for the delimiter between object levels. | None - must be specified. |
PropertyName required |
The name of the property to set. | None - must be specified. |
PropertyType |
The property type to use for the property value, one of:
AllowNull=True or an error otherwise. Incompatible conversions will result in an error. |
Use the type from the object's property. |
AllowNull |
Whether the property value is allowed to have a null value (True ) or or not (False ). |
False |
Examples
See the automated tests.
The following JSON file is consistent with the editor example above.
In this case, the object property is specified with ObjectProperty=float
.
{
"float" : 1.234,
"int" : 1234,
"bool": true,
"string" : "abcde",
"date" : "2022-10",
"datetime" : "2022-10-01 01:01:01",
"nullString" : null
}
Troubleshooting
See the main TSTool Troubleshooting documentation.
See Also
SetProperty
commandSetObjectProperty
command