Query from query

Hello, everyone. First of all: I'm new to Appian.

I have several very complex views in a PostgreSQL database that I want to replace in some way with intermediary appian objects that allow me to build the views logic step by step. Is there a way to build some kind of record type that has in-built logic from other record types or data store entities? Is there a way to call the result of some query from within another query and to call any of those from an interface?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Here is the example.

    a!localVariables(
     local!dataSet1: a!queryEntity(
          entity: cons!DSE_EMP,
          query: a!query(
            logicalexpression: a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: "name",
                  operator: "starts with",
                  value: "A"
                )
              }
            ),
            pagingInfo: a!pagingInfo(
              startIndex: 1,
              batchSize: 5
            )
          )
        ).data,
        local!dataSet2: a!queryEntity(
          entity: cons!DSE_DEPT,
          query: a!query(
            logicalexpression: a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: "name",
                  operator: "in",
                  value: {index(local!dataSet1,"name",{})}
                )
              }
            ),
            pagingInfo: a!pagingInfo(
              startIndex: 1,
              batchSize: 5
            )
          )
        ).data,
        local!dataSet2
    )

Reply
  • 0
    Certified Lead Developer

    Here is the example.

    a!localVariables(
     local!dataSet1: a!queryEntity(
          entity: cons!DSE_EMP,
          query: a!query(
            logicalexpression: a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: "name",
                  operator: "starts with",
                  value: "A"
                )
              }
            ),
            pagingInfo: a!pagingInfo(
              startIndex: 1,
              batchSize: 5
            )
          )
        ).data,
        local!dataSet2: a!queryEntity(
          entity: cons!DSE_DEPT,
          query: a!query(
            logicalexpression: a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: "name",
                  operator: "in",
                  value: {index(local!dataSet1,"name",{})}
                )
              }
            ),
            pagingInfo: a!pagingInfo(
              startIndex: 1,
              batchSize: 5
            )
          )
        ).data,
        local!dataSet2
    )

Children
No Data