Skip to main content

system.mes.unitOfMeasure.newUnitOfMeasure

Description

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

Syntax

system.mes.unitOfMeasure.newUnitOfMeasure()

Parameters

ParameterTypeDescription
None-This method does not take any parameters.

Returns

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

KeyDefault Value
namenull
symbolnull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new unit of measure object with no initial arguments
new_uom = system.mes.unitOfMeasure.newUnitOfMeasure()

# Set basic attributes for the new unit of measure
new_uom['name'] = 'Pound'
new_uom['symbol'] = 'lb'
# (You can continue setting other properties as needed here)

# Save the new unit of measure to the system
saved_uom = system.mes.unitOfMeasure.saveUnitOfMeasure(**new_uom)

# Output the JSON representation of the saved unit of measure
print(saved_uom)