Can one add extra attributes to an entity without the GUI?

Can one add extra attributes to an entity without the GUI?

Hi there,

I have an Entity in outsystems with a spesific number of attributes which I spesified.

But in my "code" if something happens I would like to add another attriubute to my entity... 

Can one even do this whithout manualy adding the enity attribute in OutSystems and recompiling it? 

Or is there anyother way to do this?


Heinrich -

That definitely cannot be done.

What is the underlying requirement? This sounds like you may need to "pivot" your data to do what you want, like you are allowing users to specify new fields for a form and what types they are. There is likely a solution without needing to add attributes to the entities.

Hi there Justin!

Yes I have a user that might need to add more 'columns" depdning on his needs... How does the "pivot" work in outsystems that you suggested? 

Kind Regards
Heinrich -

Let's take a sample application where the user is building a survey, and can add questions to it where the answers can be integers ("rate from 1 to 10"), boolean ("answer yes or no") or text ("please tell us how we did").

What you want to do is the following:

Have a static entity for "answer type", which will have entries for:

* Integer Answer Type
* Boolean Answer Type
* Text Answer Type

Next, have a "questions" entity which will store:

* The text of the question ("please rate the quality of the product from 1 to 10")
* The allowable range of integer questions ("low" = 1, "high" = 10")
* The max length of text questions
* If a text question should use a multi-line answer box or a single line
* If the answer is required
* A reference to the "answer type" static entity

Also add an entity for "answers" with a field for:

* Question ID
* User ID
* Boolean answer
* Integer answer
* Text answer

When your user adds a question, it adds to the "question" table. When the person providing the answers gives them, look to the answer type id of the questions table to determine how to display them, and put the result into the right field of the answers table.

This way, you can add as many questions as you want, but you never need to add attributes to entities in real time.