User Defined Table Columns

Imagine a a user has the power to create some key/value pairs as a composition underneath an instance of EntityA. Is there a way to programmatically generate a column for a table of EntityA for a given key without knowing if a particular instance of EntityA contains that key? I’m using this as a means of allowing users to create their own fields/columns for an entity.


There is nothing to imagine, because it is already there: Dynamic Attributes - CUBA Platform. Developer’s Manual

In a much more powerful form, though :wink:


Oooh. I’ve never actually checked those out before. Taking a quick look at the docs I got a few questions for you, oh wise Cuba master.

Is it possible for a these dynamic attributes to be defined on a per-user basis? Example: A movie library application. Some fields are applicable to everyone (Title, Year, etc.). But I care a lot about technical awards for movies so I want to track that in my own library. But for some reason care a lot about the Bacon Number of a film so you want to track that. That’s the kind of thing I’m trying for here: somehow letting a user define their own attributes.

Dynamic attributes are designed to be system-wide. Consider using Categories to differentiate the sets of attributes for users.