In my application, I have a table that maintains all codes in the system. The table has 3 main columns: category, code and description, and is used in all drop downs.
The attached file shows an example of some data in this table. The same code can be used across different categories, for example A means Category A in category “CustomerGroup” and means Adjustment in group “TransactionType”.
So the primary key is the combination of Category and Code. Moreover, the drop down fields in other entities should be attributes of type association with the code linked to the code field of the codelkup.
For example, the CustomerGroup field in the customers table should have values such as A, B, C… and the TransactionType in the transactions table should store values such as A, X, Y.
How to implement this in Cuba? Is this feasible?
Of course, one idea is to have a separate ID field for the codes table, and use it as a primary key and foreign key in other tables. But that would defeat the purpose of having a “code” field.
Any hints will be highly appreciated.