Add Attributes dynamically to the entity

Add Attributes dynamically to the entity

  

Hi All,

I want to add attributes dynamically to the entity for eg:

1. I have emp entity having only 2 attributes first_name and last_name.

2. Now i want to add birth date, Age or contact number dynamically through user actions.

3. I tried using system table- Entity_Attr to create new attributes, record is created successfully in the database but new field is not visible in aggregate or advance sql of emp entity.

May, i know any approach or what i am missing while doing this?

Regards,

Manish jawla


Hi Manish,

you cannot dynamically add new attributes to your entities.

How would your application know what to do with them? Have you thought about it?

If you're going to collect what appears to be simple data (name, age, contact, etc) why not define them at design time?

Why the need to do this in runtime?


Cheers

João

Hi Joaso,

Thanks for the response but simple data is only for an example, it was not my requirement. I want to create few attributes dynamically to my entity first and then on the basis of their datatype i will render the control also dynamically. Its more like configurable options to the customer so that they can add fields and customise the section of the basis of their requirement. If, its not possible with outsystems then its fine but I was curious if we can do this.

How would your application know what to do with them? Have you thought about it?

yes, i have all the rules what i will do with them.

Regards,

Manish jawla

Solution

Dear Manish,

maybe what you want is a dynamic form...

Take a look at this component in Outsystems Forge: https://www.outsystems.com/forge/component/1999/dynamic-forms/

Huarlem Lima did a great job with it.

Tell us if it helps you or not.

Solution

Hi Joao,

Again thanks, let me check that component whether its helpful for me or not.

Regards,

Manish Jawla

Hello Manish,

There is NO way to add ATTRIBUTES to an ENTITY dynamically.
Not directly in an OutSystems table anyway.

If you need to do that, or you create an extension and use an external table, and will still have the problem to USE it, as in OutSystems the structure must be known at design time.

Or you create something similar to a "session variable entity", where you have a fixed structure, with a text field (or binary) that will store the value and another type that stores the type of the data, plus any other fields that are required, and everytime you go look for the values, you will receive a list and will have to operate over it.

Another possibility would be to use a dynamic form and work with a rest web service that would retrieve/send the data and you render the form dynamically.

Would have to construct the JSON with the values to send back.

Cheers,
Eduardo Jauch

Thanks Joao and Eduardo for the help.