Skip to main content
saurabhs0003
September 10, 2021
Question

Expression Rule

  • September 10, 2021
  • 3 replies
  • 0 views

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
    September 10, 2021

    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
    September 11, 2021

    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
    September 11, 2021

    Use the below expression

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