Skip to main content
saurabhs0003
Known Participant
Sep 10, 2021 6:40 PM UTC
Question

Expression Rule

Hi All want to create Ann expression Rule to check weather the array of values say rollnumber with the column field in the database .

Condition

If 2 value passed and one is there and another is not there then i don't want user to continued

    3 replies

    vimals
    Participating Frequently
    Sep 10, 2021 7:11 PM UTC

    Hi,

    Are you looking for an expression to check if RollNumber1 and RollNumber2 both exist in the database?

    a!localVariables(
      local!dataSet: a!queryEntity(
        entity: "< DSE_Constant >",
        query: a!query(
          logicalExpression: a!queryLogicalExpression(
            operator: "AND",
            filters: {
              a!queryFilter(
                field: "rollnumber",
                operator: "in",
                value: { "AB000", "AB0001" }
              )
            },
            ignoreFiltersWithEmptyValues: true
          ),
          pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 50)
        ),
        fetchTotalCount: true
      ),
      if(
        local!dataSet.totalCount = length({ "AB000", "AB0001" }),
        "All Values Present",
        if(
          local!dataSet.totalCount >= 1,
          "Partially Present",
          "Not Present"
        )
      )
    )

    saurabhs0003
    Known Participant
    Sep 11, 2021 1:51 AM UTC

    What if one is present and another is not present .

    If a user is entering two at a same time . If both are present then it should be restricted and if only one  is present and another not then also it should be restricted and if both are not present then it should continue

    vimals
    Participating Frequently
    Sep 11, 2021 2:43 PM UTC

    Use the below expression

      if(
        local!dataSet.totalCount = 0,
        true, /*continue*/
        false, /*Restricted */
      )