There are total 15 tables that i need to access in the db for the record dashboa

There are total 15 tables that i need to access in the db for the record dashboard. So i have created a view in database connecting those 15 tables. Now when i created an xsd/CDT in appian and trying to save&publish in the datastore, it is throwing an error that, the view cannot be altered at db as it is a view not a table.
Can anybody let me know, how to link a CDT with database View ?

OriginalPostID-149526

OriginalPostID-149526

  Discussion posts and replies are publicly visible

  • Connecting 15 tables via a view (unless it is materialized) sounds like a performance nightmare. I recommend working with a dba to build something more performant.
  • 0
    Certified Lead Developer
    You'll want to make sure there's a unique column in your view that you can call your "key". Then in the XSD give that column the @id and @generatedValue attributes. Make sure all your columns match the CDT fields. Then your data store should publish.

    Does the ddl script tell you what it is trying to alter in the view?
  • Per the error, looks like one of the column attributes (type) does not match or you are missing identifying the unique field as @ID. You need to make a unique field (and if you are concatenating PKs from one or more tables use a separator 1-12). This will be your @ID. Don't use @GeneratedValue since you don't want a sequence.

    Also, per Myles, 15 tables will not perform well. I recommend making views where it makes sense. On a record dashboard, you can execute multiple query rules so you don't need just one call. However, make sure you are pulling only the data you need, pull when needed, don't pull all at once and check performance because excessive queries can be as costly as a bad view.

    Hope that helps
  • Also as you may not have a key unique across 15 tables, you can add a unique 'Row' column to your view and utilize that in the CDT as such below. I've also found this needs to be defined in the CDT as 'bigint', instead of int.

    <xsd:element name="Row" nillable="true" type="xsd:int">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">
    @Id
    @Column(columnDefinition="bigint NOT NULL")
    </xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    In MSSQL:

    SELECT TOP (100) PERCENT ROW_NUMBER() OVER (ORDER BY aColumnInYourTableHere) AS Row,
  • Hi All, thank you for all of your responses. problem was with underscores '_' given in between the words of the column names in view. Appian was deleting those underscores and forming a new word which was not matching with column in db while publish. Removed underscores in the view column names and done the same in xsd, which solved the problem to publish.
  • The maximum number of tables that can be referenced in the definition of a view is around 60 (for MySQL).
    However, if we are joining over 20 tables, that means we are stretching the system, so need to take care of performance.
    Now come to the error:
    * After creation of CDT/XSD import, we add an entity to data store by "Add entity".
    * Then if we click "Verify", it will show all errors like (missing column name, missing column type, missing a_id etc..).
    As per my understanding all these possible errors can be thrown at "Verify" action itself, not at "Save & Publish" action.