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

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

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

Children
No Data