Combining Multiple CDTs

Is it possible to join tables stored in different entities on the cloud with a unique primary key?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    I'm not sure what you would hope to gain out of such an arrangement.

    What you could do is search a table on one schema for ID that matches soft foreign key in a CDT you already got. (Soft foreign key means you ASSUME there's going to be a valid row on the other side of the reference, but you can't confirm it or enforce any sort of constraint.  It usually works, but you'll have to deal with the possibility that it might not on the rare occasion.)

    You can store two only loosely related CDTs and possibly display data from one or the other as you choose on a grid, or whatever you intend to do with the data. 

    It might be a lot more work than trying to find some way of getting one of the tables migrated over to the other schema, or even a copy of it.  Then you could grab your CDT from a VIEW you build with the JOINs baked in.

  • Typically (although you may have a different specific use-case) you join two database tables because they're related AND because you want to avoid the overhead of multiple round-trips between Appian and the database (so you can get your related data from those two tables in one call)

    Typically (but same caveat as above!) those tables are related parent-child (that is one-to-many). The act of joining those tables (to create a VIEW) means denormalising the relationship between them. Given that one 'parent' will have many  'children' you would see a list of 'children' many of which would have the same 'parent'. So you would be safe in using the child's Primary Key as the unique attribute to identify each row.

    Once you have a VIEW you can then use the tooling in Appian to create a single CDT from that VIEW, hence "combining" two CDTs.If you had other related tables you simply look for the entity at the bottom of any relationship hierarchy and choose that Primary Key as your unique attribute.