Create columns with names in row values of a related entity

Hi everyone,


I'm starting to do some stuff in Outsystems and still very n00b. I'm facing a challenge regarding using the values of an entity to generate columns in other entity.

Example

Entity A                                         Entity B

Id | AttributeName                        Id | Size | Type

1  | Size

2  | Type 


How can I achieve this?

cpinho wrote:

Hi everyone,


I'm starting to do some stuff in Outsystems and still very n00b. I'm facing a challenge regarding using the values of an entity to generate columns in other entity.

Example

Entity A                                         Entity B

Id | AttributeName                        Id | Size | Type

1  | Size

2  | Type 


How can I achieve this?

I don't think you can dynamically create an entity from code in the first place.


Regards,

JC


Hi cpinho,

Take a look at this topic:

https://www.outsystems.com/forums/discussion/20336/how-to-concatenate-multiple-rows-of-data-into-single-row/

I hope this help you,

Regards,

Leandro.

Hi,

Do you want to create dynamic Entity and its attribute? Please confirm me.

Thank you,

Sudip

Sudip Dey wrote:

Hi,

Do you want to create dynamic Entity and its attribute? Please confirm me.

Thank you,

Sudip

Hi Sudip,


No. The entity B is already there. What I want is to get the values of the Attributename (Entity A) as Attributes in Entity B. 


means Entity A and Entity B are already created. You need to store data of Entity B to Entity A. Am I right?

Please let me know

The other way around.

Lets say that Entity A AttributeName column has in the rows the following values:


Attribute1

Attribute2

Attribute3


In the Entity B, I would like to get:

Entity Headers -> ID | Attribute1 | Attribute2 | Attribute3


Solution

cpinho wrote:

The other way around.

Lets say that Entity A AttributeName column has in the rows the following values:


Attribute1

Attribute2

Attribute3


In the Entity B, I would like to get:

Entity Headers -> ID | Attribute1 | Attribute2 | Attribute3


This is the part where I am confused.

If you wanted to just concatenate the values of Attribute1, Attribute2 and Attribute3 on a single column, regardless if it goes to another table or not, then Leandro's reply would just be what you need. 

On this reply where you wanted Entity A's attributes create the entity headers for Entity B, isn't that the same thing (Columns or Fields == Entity Headers)?

Again, if it is just data, SQL can help you on that or an Assign (maybe inside a loop for one time thing). But if you wanted to create additional attributes or fields on an entity (Entity B). I don't think you can do that. Like even a creation of an Entity out of nothing. I haven't came across a function to do that in OS. To create an entity or its attributes, you need to create them in Service Studio in the Data tab.

Cheers!

JC

Solution

Juan Carlos Elorde wrote:

cpinho wrote:

The other way around.

Lets say that Entity A AttributeName column has in the rows the following values:


Attribute1

Attribute2

Attribute3


In the Entity B, I would like to get:

Entity Headers -> ID | Attribute1 | Attribute2 | Attribute3


This is the part where I am confused.

If you wanted to just concatenate the values of Attribute1, Attribute2 and Attribute3 on a single column, regardless if it goes to another table or not, then Leandro's reply would just be what you need. 

On this reply where you wanted Entity A's attributes create the entity headers for Entity B, isn't that the same thing (Columns or Fields == Entity Headers)?

Again, if it is just data, SQL can help you on that or an Assign (maybe inside a loop for one time thing). But if you wanted to create additional attributes or fields on an entity (Entity B). I don't think you can do that. Like even a creation of an Entity out of nothing. I haven't came across a function to do that in OS. To create an entity or its attributes, you need to create them in Service Studio in the Data tab.

Cheers!

JC

Thanks Juan. I dont want to concatenate but use entity b filtered by another column and avoid a hundred columns. Yes, you are right, headers or columns are the same in this case. In SQL this would be kind of pivot a column into headers i think.