I have a generic question about CDTs. I have a CDT which have few elements

Certified Senior Developer
I have a generic question about CDTs.
I have a CDT which have few elements in it, some of them are multi value. Once I create a Data store containing this CDT, apian generates database tables for CDT as well as for each of the element that are multi value.
If I save this CDT data is saved in all these tables in Normalized fashion.

alternate way to do the same is I create a CDT with all elements and keep them as single value even for one which can be multi value(Do not check the checkbox for multi value). but when inside the process model where I define the pvs for this CDT, I declare that pv itself as multi value pv.
In this approach all the data would be available in a single table in de-normalized manner.

Is there any best practice that suggests that one approach is better than another? I am inclined to using 2nd one as the data in table is more readable as well as it can easily be made available to other systems.

Please suggest.

OriginalPostID-143301

OriginalPostID-143301

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    My preference is to design and create a normalised database and then manually map CDTs and the data entities to the tables, nesting only lookup fields (types etc) where possible and setting the JPA annotations to write and update as appropriate.

    Nesting normalised lookups within the CDTs will mean retrieval of data for dropdowns, radio buttons etc is easily achieved using query rules, and display of the normalised data will not require any extra query rule execution. That said, there's nothing wrong with using a "flat" CDT and data entity layout where lookups are not nested and data is retrieved when required for display - but the data is still normalised.

    Normalised lookup data also makes adding a new option for a field as simple as inserting a row into the database lookup table, whilst non-normalised generally means you must also hold the options and/or IDs in a constant. The latter may actually be a good thing depending on the abilities of those maintaining the application.