Skip to main content
November 16, 2021
Question

Do we need to specify columnDefinition for view CDTs?

  • November 16, 2021
  • 6 replies
  • 0 views

Hello All,

I would like to know what is the best practice while creating view CDT's? do we need to specify column length while creating view cdt's?

Observed column length in view cdt is different from actual table column length, in this scenario view still exists upon publishing view cdt.

6 replies

stefanhelzle0001
November 16, 2021

No. Appian would use the field definition if it would create the table for you. As you map the CDT to a view, length is not relevant.

November 17, 2021

Thank you for the response.

Curious to know how Appian DS publish will recognize the CDT as a view?

When I download the DDL script of the view which is generated upon verify of DS, it says to create a table for view.

Ex: below is the snippet of view DDL script and the xsd. I have not specified any column length for the varchar field in xsd and it's automatically adding as 255 chars.

So is it advisable to create the view in DB first and later publish it via CDT? if so above DDL is not valid as DB object exists with the same name ? please help to understand how publishing works for views?

stefanhelzle0001
November 17, 2021

Appian does not know about views. When validating the data store, it tries to get the structure for an existing table OR view. If that does not match, it tries to create TABLES.

Our approach is: Let Appian manage all the tables, then create a SQL script which adds any necessary indexes and views. That script includes a "DROP TABLE" statement for each view because Appian created that as the datastore was published.

There are other approaches, but this works very well for us.

csteward
November 16, 2021

In addition, the only time I use columnDefinition in view CDTs is within the IDENTITY column.  On some occasions we will have to annotate with @Column(name="xyz"), but typically only when the column name is longer than 27 characters, and if I can recall I believe in some situations with underscores in column names.