Cannot apply operator [EQUALS] to field [policyStatus] when comparing to value [TypedValue[it=126,v={1}]].

/* I am trying to extract cancelled status but having error.
Can you please help me. Thank you*/

a!queryEntity(
  fetchTotalCount: true,
  entity: cons!CAS_DSE_VIEW_POLICY_RECORD,
  query: a!query(
    pagingInfo: if(
      rule!GBL_isBlank(ri!pagingInfo),
      a!pagingInfo(
        startIndex: 1,
        batchSize: 5
      ),
      ri!pagingInfo
    ),
    logicalExpression: a!queryLogicalExpression(
      operator: "AND",
      filters: {
        if(
          rule!GBL_isBlank(ri!policySearch.policyId),
          {},
          a!queryFilter(
            field: "policyId",
            value: ri!policySearch.policyId,
            operator: "="
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.currency),
          {},
          a!queryFilter(
            field: "projectCurrency",
            value: ri!policySearch.currency,
            operator: "="
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.carrierPolicyId),
          {},
          a!queryFilter(
            field: "carrierPolicyId",
            value: ri!policySearch.carrierPolicyId,
            operator: "includes"
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.carrierName),
          {},
          a!queryFilter(
            field: "carrierName",
            value: ri!policySearch.carrierName,
            operator: "includes"
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.coverageCode),
          {},
          a!queryFilter(
            field: "coverageCode",
            value: ri!policySearch.coverageCode,
            operator: "="
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.aonCustomerId),
          {},
          a!queryFilter(
            field: "aonCustomerId",
            value: ri!policySearch.aonCustomerId,
            operator: "starts with"
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.customerName),
          {},
          a!queryFilter(
            field: "customerName",
            value: ri!policySearch.customerName,
            operator: "includes"
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.aonProjectId),
          {},
          a!queryFilter(
            field: "aonProjectId",
            value: ri!policySearch.aonProjectId,
            operator: "starts with"
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.policyStatus),
          {},
          a!queryFilter(
            field: "policyStatus",
            operator: "in",
            value: ri!policySearch.policyStatus
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.practice),
          {},
          a!queryFilter(
            field: "practice",
            value: ri!policySearch.practice,
            operator: "in"
          )
        ),
        if(
          rule!GBL_isBlank(ri!policySearch.cancelledPolicies),
          {},
          a!queryFilter(
            field: "policyStatus",
            operator: "=",             
                  applyWhen: ri!policySearch.cancelledPolicies = true,
                  value: if((ri!policySearch.cancelledPolicies = true),
                  (ri!policySearch.policyStatus <> cons!CAS_REFERENCE_DATA_ID_POLICY_STATUS_CANCELLED),
                  ri!policySearch.policyStatus)
                )
            ),
      }
    )
  )
)

I am trying to extract cancelled status but having error.
Can you please help me. Thank you

  Discussion posts and replies are publicly visible

Parents Reply
  • Hi Stefan, 

    Tostring works well and we're able to exclude canceled status when checkbox is ticked, thank you very much for your help. However, when checkbox and dropdown for policy status both have value, we don't fetch any details at all, e.g., we have OPEN status selected for dropdown and the checkbox is ticked. Do you have any idea why this happened?  

    if(
              rule!GBL_isBlank(ri!policySearch.policyStatus),
              {},
              a!queryFilter(
                field: "policyStatus",
                operator: "in",
                value: ri!policySearch.policyStatus
              )
            ),
    if(
              rule!GBL_isBlank(ri!policySearch.cancelledPolicies),
              {},
              a!queryFilter(
                field: "policyStatus",
                operator: if (
                  ri!policySearch.cancelledPolicies = true,
                  "<>","in"),
                applyWhen: ri!policySearch.cancelledPolicies = true,
                value: tostring(index(ri!policySearch.policyStatus, 1, "Cancelled"))
                )
               ),

Children