I have some doubts regarding the mapping among "DB-> CDT-> Query Rule

I have some doubts regarding the mapping among "DB-> CDT-> Query Rule"
1). Can we map a CDT to existing database table which does not have any primary key defined? (I cannot modify the existing tables and the tables don't have primary keys defined. I tried but it does not allow to map if the Primary Key is not there)

2). Can we map a CDT to SQL function and use it to retrieve the data from function? (I guess we cannot)...

OriginalPostID-124907

OriginalPostID-124907

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    1) Yes this is possible, the underlying database table does not need to have a primary key defined at the DB level however you must annotate one column using the @Id jpa annotation. I would hope that the table does have some level of unique-ness so choose the appropriate column for this. If your column does not contain unique data then you will not see the full resultset when using query rules.
    2) This may depend on your RDBMS, in Oracle for example you can define function based columns in both tables and views which can be mapped to appian datatypes
  • Tim, thanks for your reply.
    Problem here is with the tables I need to deal with, these are old tables and unique row is not defined by a single column in the existing tables and I searched, composite primary keys are not supported by Appian 7.6 and older.
    it seems that the only option remaining is to have a surrogate key and convince the team to change the tables structure.