Skip to main content

system.mes.unitOfMeasure.validateUnitOfMeasureConversion

Description

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

Syntax

system.mes.unitOfMeasure.validateUnitOfMeasureConversion(**uomc_data)

Parameters

ParameterTypeDescription
fromIdString (ULID)The unit of measure the conversion is converting from.
toIdString (ULID)The unit of measure the conversion is converting to.
conversionFactorDoubleThe number used to change the unit of measure from one set to the other.
materialIdString (ULID)The material associated with the unit of measure conversion.
idString (ULID)The ULID of the unit of measure conversion (optional, used for updating an existing unit of measure conversion).
notesStringNotes related to the unit of measure conversion.
enabledBooleanIndicates if the unit of measure conversion 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 conversion object
uomc_data = system.mes.unitOfMeasure.newUnitOfMeasureConversion()

# Set basic attributes for the new unit of measure conversion
uomc_data['toId'] = '01JCH3T85P-KVCB8ZR5-0B83A3SX'
uomc_data['conversionFactor'] = '0.33'
uomc_data['fromId'] = '01JCH4NB3J-BTERAZ27-QEQQN4ME'
# (You can continue setting other properties as needed here)

# Validate unit of measure conversion parameters
validation_errors = system.mes.unitOfMeasure.validateUnitOfMeasureConversion(**uomc_data)

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