Do we need to specify columnDefinition for view CDTs?

Certified Senior Developer

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.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    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.

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

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    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?

  • 0
    Certified Lead Developer
    in reply to Sneha Yada

    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.

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Thank You very much for your response and now it's more clear that why we don't need to specify column configuration for views.

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Hello,

    Would like to clarify is there any special logic for CLOB columns? or char columns which are >255 chars?

    When I tried to upload the view xsd which has a column with CLOB datatype in the database, and I didn't specify the column configuration in the XSD then the below error is shown. And once I specify the datatype I'm able to save the XSD and publish it.

    Please help to understand what this error means? do we need to specify the column definition for CLOB data types? if so what are the other column types we need to specify the column definition?