Skip to main content
August 17, 2022
Question

How to write this sql command in appian rules

  • August 17, 2022
  • 3 replies
  • 0 views

select * from Table where column1= value1 and column2= value2 and ( column3= value3 or column4 = value4)

I need to query above sql command into appian query. How can I write? Can anyone help me with this please.

    3 replies

    August 17, 2022

    you have to use nested querylogicalExpression to do this.

    a!queryEntity(
      entity: cons!UAS_DSE,
      query: a!query(
        pagingInfo: a!pagingInfo(1,-1),
        logicalExpression: a!queryLogicalExpression(
          operator: "AND",
          filters:{
            a!queryFilter(
              field: "accountid", /*COLUMN1*/
              operator: "=",
              value: "VU28682"
            ),
    
            a!queryFilter(
              field: "accountname", /*COLUMN2*/
              operator: "=",
              value:"THE 2012 RECKLING GREAT GRANCHILDREN'S TRUST DTD 12/3/2012 FOR LUKE JORNAYVAZ"
            )
          },
          logicalExpressions: a!queryLogicalExpression(
            operator: "OR",
            filters: {
              a!queryFilter(
                field: "status", /*COLUMN3*/
                operator: "=",
                value:"Categorize New Holding"
              ),
    
              a!queryFilter(
                field: "processId", /*COLUMN4*/
                operator: "=",
                value:536877759
              )
            }
          )
        )
      )
    ).data

    August 17, 2022

    Thanks

    harshitb6843
    August 17, 2022

    Use the query editor from the toolbar to apply all these filters visually and then check the rule Appian generates for you to understand how queries are configured using a!queryEntity()