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

  • 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
    )

  • 0
    Certified Lead Developer

    Yes, but in a different way than you might think. Appian is no data warehouse platform where you could do complex data processing in high volumes. But, with the latest data fabric feature, you can fetch data from various sources and use custom record fields to aggregate data from other sources. Then you can query that data and visualize it.

    Can you give us a bit if a background on your ask?

  • Thank you, , I'll take a look into data fabric.

    We have an application that is currently built using React and we'd like to simplify our application development (which is why we're considering Appian).

    The purpose of this application is more or less to show some entities (municipalities, states, etc.) and allow data registrars to edit certain records related to the aforementioned entities. The problem we're facing right now is that this application relies on several complex and somewhat slow views (i.e. somewhat computationally expensive) that feed the user's application interface.

    These views integrate data from several tables within the same database, and my intent so far has been to try to migrate this application to Appian by creating record types for the tables that we use, and then try to define some kind of record-type object that holds "intermediary" logic steps in order to break down the logic of our views into Appian objects. I want to avoid creating very complex queries to feed some kind of Appian interface, since it's in no way more manageable than our current complex PostgreSQL view definitions.

    Does this sound feasible? Am I misunderstanding something about how Appian is meant to be used? So far, it seems to me that Appian works very well when it comes to dealing with complex logic that is triggered by user actions, but I'm having a hard time trying to create logic-intensive "views" –user interfaces–.

    I'd really appreciate any kind of guidance.

  • 0
    Certified Lead Developer
    in reply to jorge.mendoza

    I understand. Without much more details, it is impossible to give any concrete advice. Using Appian to just maintain some database tables is not what I would consider a great use case. But maybe you want to add more complex processes later, so this might be the first step only.

    With Appian syncronized records, you can easily build a complex data model and query data across tables. If your data volume is within the limitations (2mio rows, <4k characters in text fields), that should work. I suggest to spend a bit of research on that feature to fully understand it, before building the actual application.

    Coming from normal web development you will need a bit of time to adjust your way of solving problems to the Appian way.