Getting database data into nest CDT

 Hi,

I'm looking for examples on getting database data into a CDT with child CDT (nested).  For example there is an order and a customer table.  Each order has only one customer, i.e. one-to-one relationship.

I was reading the doc Custom Data Type (CDT) Relationships but still unsure of how to implement this.  Also, what if there is no relationship setup between the order and customer tables in the database but I have access read-only access to both tables?  Would it still work?

Thanks.

 

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    You will need a relationship (i.e. a foreign key) between the two tables to take advantage of JPA annotations as they require that you specific a set of JOIN columns in order to associate them. The easiest way to do this is by starting with the guide at the bottom of the documentation you listed: 

    docs.appian.com/.../CDT_Relationships.html

    Say you want your Order (Parent) to reference Customer data (Child). Start by creating the Customer CDT and mapping to the database. Then while creating the Order CDT, you'll create a field in the CDT of complex type Customer. Click the Key column that shows up and that's where the "Configure Field Relationship" modal referenced in the docs appears

    And then I like to use the last check box to state my column name - this would be the column in Order to references the Customer

  • Hi Jude,

    what you are not able to understand in the Custom Data Type (CDT) Relationships ? you need to create two CDT one will act as Parent (customer ) and other will as Child (order) . first create child CDT and then create Parent CDT and create one field in Parent CDT and set type as child CDT as suggested in the url. Now publish both CDT in data store.

    When you will access the data from Parent CDT ( table) then child table data will automatically will come, you don't need to do anything from your side.

    You can find how data store work follow this link : https://docs.appian.com/suite/help/18.3/Data_Stores.html

    Let me know if you will face any issue.

    Regards

    Abhay