Skip to main content

system.mes.location.newProperty

Description

Generates an empty non-persisted Location Properties object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveProperty method in order to persist the record.

Syntax

system.mes.location.newProperty()

Parameters

ParameterTypeNullableDescription
None--This method does not take any parameters.

Returns

Returns a JSON representation of the newly created location property object. The following is a list of keys and default values:

KeyDefault Value
namenull
descriptionnull
dataTypeString
lowLimitnull
highLimitnull
formatnull
unitOfMeasureIdnull
unitOfMeasureNamenull
unitOfMeasureSymbolnull
optionsnull
nullablefalse
defaultValuenull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new property object with no initial arguments
newProperty = system.mes.location.newProperty()

# Define property details
newProperty['name'] = 'Temperature'
newProperty['dataType'] = 'Float'
newProperty['unitOfMeasureId'] = '01JAP8RJBN-4VYZUKE1-LY2QHV8X'
newProperty['nullable'] = False
newProperty['lowLimit'] = -20
newProperty['highLimit'] = 50
# (You can continue setting other properties as needed here)

# Save the property
savedProperty = system.mes.location.saveProperty(**newProperty)

# Output the JSON representation of the saved property
print(savedProperty)