Skip to main content

system.mes.query.validateFilterRequest

Description

Validates the specified parameters for a Filter Request record and returns any validation errors. This only checks if the filter request can be performed based on the attributes given, without actually executing the filter request. Use this function to verify your parameters before executing a filter request operation.

Syntax

system.mes.query.validateFilterRequest(**filterRequest)

Parameters

ParameterTypeNullableDescription
fieldStringFalseName of the field to filter by. This should be the name as it appears in the entity class (required).
typeStringTrueType of the field being filtered by. If not provided, the type will be inferred from the value.
conditionStringFalseCondition used to compare the field against the value (required).
stringValueStringTrueString value to compare the database field value against.
numberValueDoubleTrueNumerical value to compare the database field value against.
dateValueInstantTrueDate value to compare the database field value against.
minNumberValueDoubleTrueMinimum numerical value for the field. Only used when the condition is BETWEEN.
maxNumberValueDoubleTrueMaximum numerical value for the field. Only used when the condition is BETWEEN.
minDateValueInstantTrueMinimum date value for the field. Only used when the condition is BETWEEN.
maxDateValueInstantTrueMaximum date value for the field. Only used when the condition is BETWEEN.
stringListValueList<String>TrueList of String values to compare the database field value against.
numberListValueList<Double>TrueList of Numerical values to compare the database field value against.
dateListValueList<Instant>TrueList of Date values to compare the database field value against.

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 filter request object
filter_request_data = system.mes.query.newFilterRequest()

# Set basic attributes for the new filter request
filter_request_data["field"] = "createdDate"
filter_request_data["dateValue"] = "2024-01-01T00:00:00Z"
# Since the condition field is not set, this is not valid
# (You can continue setting other properties as needed here)

# Validate filter request parameters
validation_errors = system.mes.query.validateFilterRequest(**filter_request_data)

if len(validation_errors) > 0:
print('Validation errors found:', validation_errors)
else:
print('Filter request parameters are valid.')