Skip to main content

system.mes.unitOfMeasure.validateUnitOfMeasure

Description

Validates the specified parameters for a Units Of Measure record and returns any validation errors. This only checks if the unit of measure object can be saved based on the attributes given.

Syntax

system.mes.unitOfMeasure.validateUnitOfMeasure(**uom_data)

Parameters

ParameterTypeDescription
nameStringThe name of the unit of measure.
symbolStringThe symbol of the unit of measure.
idString (ULID)The ULID of the unit of measure (optional, used for updating an existing unit of measure).
notesStringNotes related to the unit of measure.
enabledBooleanIndicates if the unit of measure is active and enabled.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional field for user-defined context.

Returns

Returns a JSON object where keys are field names and values are lists of validation violation messages.

Code Examples

# Generate the object structure for a new unit of measure object
uom_data = system.mes.unitOfMeasure.newUnitOfMeasure()

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

# Validate unit of measure parameters
validation_errors = system.mes.unitOfMeasure.validateUnitOfMeasure(**uom_data)

if len(validation_errors) > 0:
print('Validation errors found:', validation_errors)
else:
print('Unit of measure parameters are valid.')