Skip to main content
April 17, 2025
Question

Error evaluating expression

  • April 17, 2025
  • 4 replies
  • 0 views

Hi I have written this query to fetch result based on two filter criteria. When I am passing either of employeeId or Created by it throws the following error. But if I pass both employeeId and CreatedBy it works properly. Can anyone help as in what is wrong in this?

The error:

The code:

rule!NGS_queryEntityRefresh(
dataStoreEntity: cons!NGS_DSE_QPP_PERFORMANCE_TRACKER,
returnType: ri!returnType,
executeWhen: ri!executeWhen,
queryLogicalExpression: a!queryLogicalExpression(
operator: "OR",
logicalExpressions: {
a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(
field: "employeeId",
operator: "in",
value: ri!employeeIds,
applyWhen: not(rule!NGS_isBlank(ri!employeeIds))
),
a!queryFilter(
field: "discussionTopicRefId",
operator: "in",
value: ri!discussionTopicRefIds,
applyWhen: not(rule!NGS_isBlank(ri!employeeIds))
),
a!queryFilter(
field: "discussionSubtopicRefId",
operator: "in",
value: ri!discussionSubtopicRefIds,
applyWhen: not(rule!NGS_isBlank(ri!employeeIds))
),
a!queryFilter(
field: "date",
operator: ">=",
value: ri!startDate,
applyWhen: not(rule!NGS_isBlank(ri!employeeIds))
),
a!queryFilter(
field: "date",
operator: "<=",
value: ri!endDate,
applyWhen: not(rule!NGS_isBlank(ri!employeeIds))
),
a!queryFilter(
field: "isActive",
operator: "=",
value: true,
applyWhen: not(rule!NGS_isBlank(ri!employeeIds))
),
a!queryFilter(
field: "followUpStatusRefId",
operator: "in",
value: ri!followUpStatusRefId,
applyWhen: not(rule!NGS_isBlank(ri!employeeIds))
)
},
ignoreFiltersWithEmptyValues: true
),
a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(
field: "discussionTopicRefId",
operator: "in",
value: ri!discussionTopicRefIds,
applyWhen: not(rule!NGS_isBlank(ri!createdBy))
),
a!queryFilter(
field: "discussionSubtopicRefId",
operator: "in",
value: ri!discussionSubtopicRefIds,
applyWhen: not(rule!NGS_isBlank(ri!createdBy))
),
a!queryFilter(
field: "date",
operator: ">=",
value: ri!startDate,
applyWhen: not(rule!NGS_isBlank(ri!createdBy))
),
a!queryFilter(
field: "date",
operator: "<=",
value: ri!endDate,
applyWhen: not(rule!NGS_isBlank(ri!createdBy))
),
a!queryFilter(
field: "isActive",
operator: "=",
value: true,
applyWhen: not(rule!NGS_isBlank(ri!createdBy))
),
a!queryFilter(
field: "followUpStatusRefId",
operator: "in",
value: ri!followUpStatusRefId,
applyWhen: not(rule!NGS_isBlank(ri!createdBy))
),
a!queryFilter(
field: "createdBy",
operator: "in",
value: ri!createdBy,
applyWhen: not(rule!NGS_isBlank(ri!createdBy))
)

},
ignoreFiltersWithEmptyValues: true
)
}
),
pagingInfo: ri!pagingInfo,
fetchTotalCount: true
)

    4 replies

    April 18, 2025

    Can you show how the queryEntity is configured in your NGS_queryEntityRefresh expression?

    mathieud0001
    April 18, 2025

    Did you try simply wrapping each queryLogicalExpression with an if statement instead of putting an applyWhen on every filter?

    mikes0011
    Brainy
    April 18, 2025

    Looking through the query filters in each branch of the top-level OR clause, I can see there's an even better way to make this far more efficient.  

    All of the queryFilters between the two main branches are identical except that one of them filters on "employeeId" and the other one filters on "createdBy".  Therefore, the top-level QLE should be an "AND", it should contain all 6 of the identical query filters that match between the two, and it should contain a sub-QLE, using "OR", that has the queryFilters for createdBy and for employeeId.

    stefanhelzle0001
    April 18, 2025

    This points towards a performance issue resulting in a timeout. The tomcat stdout log file will get you the details.