between operator not working

a!queryFilter(
          field: "expiredDays_int",
          operator:"between",
          value: {rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
            selectedItemType_txt: 1
          ).startIndex_int,
          rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
            selectedItemType_txt: 31
          ).endIndex_int
          }
        )

how can write this query without between operator 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi Kavya, i think you had asked similar question in another thread right? you can use logical expression with "<" and ">" operators in your filters. By the way what is the issue using between? and can you post the outptut of the rule rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
    selectedItemType_txt: 1
    ).startIndex_int

  • Hi , yes i have asked the same question but those solutions were not working. 

    that between giving wrong count in UI.. but same query i try in db it's giving correct count 

    a!queryEntity(
      entity: cons!CR_CMU_ENTITY_DU_MONITORING,
      query: a!query(
        logicalExpression: a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field: "status_txt",
              operator: "=",
              value: "OPEN"
            ),
            a!queryFilter(
              field: "buRowSecurityId_txt",
              operator: "includes",
              value: rule!CR_FN_getNBFUserEmailId(
                loggedInUserName_txt: ri!loggedInUserName_txt
              ),
              applyWhen: rule!CR_CMU_FN_buRowSecurityIdFilterCondition(
                role_txt: ri!role_txt
              )
            ),
            a!queryFilter(
              field: "ccRowSecurityId_txt",
              operator: "includes",
              value: rule!CR_FN_getNBFUserEmailId(
                loggedInUserName_txt: ri!loggedInUserName_txt
              ),
              applyWhen: rule!CR_CMU_FN_ccRowSecurityIdFilterCondition(
                role_txt: ri!role_txt
              )
            ),
            a!queryFilter(
              field: "mortgageSummaryFlag_int",
              operator: "=",
              value: 1,
              applyWhen: ri!selectedItemReportType_txt = cons!CR_SECURITY_DOCUMENTATION_REPORT_TYPES[3]
            ),
            a!queryFilter(
              field: "slcFgsFlag_int",
              operator: "=",
              value: 1,
              applyWhen: ri!selectedItemReportType_txt = cons!CR_SECURITY_DOCUMENTATION_REPORT_TYPES[6]
            ),
            a!queryFilter(
              field: "insuranceMonitoringFlag_int",
              operator: "=",
              value: 1,
              applyWhen: ri!selectedItemReportType_txt = cons!CR_SECURITY_DOCUMENTATION_REPORT_TYPES[5]
            ),
            a!queryFilter(
              field: "docDeferralMonitoringFlag_int",
              operator: "=",
              value: 1,
              applyWhen: ri!selectedItemReportType_txt = cons!CR_SECURITY_DOCUMENTATION_REPORT_TYPES[2]
            ),
            a!queryFilter(
              field: "securitiesDefectFlag_int",
              operator: "=",
              value: 1,
              applyWhen: ri!selectedItemReportType_txt = cons!CR_SECURITY_DOCUMENTATION_REPORT_TYPES[1]
            ),
            a!queryFilter(
              field: "expiredDays_int",
              operator:"between",
              value: {rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
                selectedItemType_txt: ri!selectedItemType_txt
              ).startIndex_int,
              rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
                selectedItemType_txt: ri!selectedItemType_txt
              ).endIndex_int
              },
              applyWhen: or(
                ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[1],
                ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[2],
                ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[3],
              )
            ),
            a!queryFilter(
              field: "expiredDays_int",
              operator: ">",
              value: rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
                selectedItemType_txt: ri!selectedItemType_txt
              ).startIndex_int,
              applyWhen: ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[4]
            )
          },
          ignoreFiltersWithEmptyValues: true
        ),
        pagingInfo: ri!pagingInfo
      ),
      fetchTotalCount: true()
    )

  • 0
    Certified Senior Developer
    in reply to KM

    did you try this input and checked?

  • yes, still getting wrong count. need count as 312 but getting 304

    a!queryFilter(
              field: "expiredDays_int",
              operator: "between",
              value: {rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
                selectedItemType_txt: "Past Due in 1-30 days"
              ).startIndex_int,
              rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
                selectedItemType_txt: "Past Due in 1-30 days"
              ).endIndex_int},
              applyWhen: 
              ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[3]
            )

  • 0
    Certified Lead Developer
    in reply to KM

    Did you try to use the operators "=>" and "<=" instead of ">" and "<"?

  • yes, that is giving error as 

      a!queryFilter(
              field: "expiredDays_int",
              operator:"<=",
              value: {
              rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
                selectedItemType_txt: ri!selectedItemType_txt
              ).endIndex_int
              },
              applyWhen: or(
                ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[1],
                ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[2],
                ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[3],
              )
            ),
            a!queryFilter(
              field: "expiredDays_int",
              operator: ">=",
              value: rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
                selectedItemType_txt: ri!selectedItemType_txt
              ).startIndex_int,
              applyWhen: or(ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[4], 
              ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[1],
              ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[2],
              ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[3])
            )

  • 0
    Certified Lead Developer
    in reply to KM

    This is the same problem as in the other post. You cannot use a list as the value.

  • for this code and decision rule can't we come up with different solution?

  • 0
    Certified Lead Developer
    in reply to KM

    What does "different" mean?

    If the "between" operator does not work the way you need it, you can't use it.

    If the decision returns value you cannot use with "<=" or ">=", you will need to modify the decision, or the returned values.

  • that's what how can i change the decision rule, please help me...

    or is their any other option to come up with other solution 

  • 0
    Certified Lead Developer
    in reply to KM

    I tried to change your code so it picks the first item in the returned list. Please try this.

    a!queryFilter(
              field: "expiredDays_int",
              operator:"<=",
              value: index(
              rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
                selectedItemType_txt: ri!selectedItemType_txt
              ).endIndex_int, 1, 0
              ),
              applyWhen: or(
                ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[1],
                ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[2],
                ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[3],
              )
            ),
            a!queryFilter(
              field: "expiredDays_int",
              operator: ">=",
              value: index(
                rule!CR_CMU_DSC_getExpiredDaysInSecurityDocumentation(
                  selectedItemType_txt: ri!selectedItemType_txt
                ).startIndex_int, 1, 0
              ),
              applyWhen: or(ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[4], 
              ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[1],
              ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[2],
              ri!selectedItemType_txt = cons!CR_CMU_GRID_LABEL_BUCKET_VALUES[3])
            )

  • Hi here the issue is batch size in the paging.. count is miss matching..

    when i give the batch size =-1 then count will match to db data 

    when i give the batch size =10 or 1 or 20 or 50 whatever it will miss match the count from db to UI 

    why this will happen! what is the exact issue? why batch size is giving issue?

    can anyone help me with this 

Reply Children
No Data