multiple CDT from a single database table

Is that possible to create multiple CDT from a single database table ?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • I would like to make a field value as default in application whenever a record is entered in the database. I have updated the table and set the dafault value in the database for  that particular column. But when I tried to enter values in a row in the table the default values do not populate in the table.

  • If you want to have default values in the table upon insert, you can add the default values to the required attribute(s) in the following ways:

    • During any field saveInto:{}. This is at Interface level
    • Inside the process after completion of the User Input Task and before Write to Data store Entity.

    In both ways, you can also define any logic that determines the default value.

  • the interface fields are populated from the database table fields. So the default must be implemneted at database level.

  •  

    Database Level Default Setting and CDT for writing and reading:

    To insert the database table field's default value using write to datastore entity follow the below steps:

    • Create a table with one or more default value field
    • When creating a CDT from DB table for inserting values, don't include the default value field. So that, while inserting a value, table will take the default value.
    • If you include the default value field, Appian will assign null value to the field. This will lead to overriding of the default value in the table.

    To populate the database table field's default value on the screen

    • Create a CDT from DB table for populating values, include the default value field. So that, while fetching  data from table, system will pull the default value.
    • Remember you need this separate cdt than what you created before

    Alternatives with intermediate modification:

    To insert the database table field's default value using write to datastore entity follow the below steps:

    If you want to have default values in the table upon insert, you can add the default values to the required attribute(s) in the following ways:

    • During any field saveInto:{}. This is at Interface level
    • Inside the process after completion of the User Input Task and before Write to Data store Entity.

    In both ways, you can also define any logic that determines the default value.

    To populate the database table field's default value on the screen

    You can assign the default values to the CDT attributes, before populating on the screen.

    • Fetch the values from the table and map it to cdt
    • Update the default value to CDT attribute where default value is required
    • Populate the CDT values on the screen