How can I structure my data tables to allow multiple images per record?

As 1 database entity can only have 1 attribute of "binary data" type, how can I structure my data tables to allow multiple images per record?

YS Yeo wrote:

As 1 database entity can only have 1 attribute of "binary data" type, how can I structure my data tables to allow multiple images per record?

Hi YS Yeo,

Not Possible to use more than 1 attribute of type Binary Data in Outsystems.

Outsystem Recommendation : Depending on your requirements, either change the data type of one of these attributes or create a new entity and move one of these attributes to this new entity.


Thus Only way to do so is create a second entity that connect to the main entity with a relation one-to-many, and in the second entity you can save how many images you need (one for row) and keep linked to the first by the ID.

I hope this help :)

assif_tiger wrote:

YS Yeo wrote:

As 1 database entity can only have 1 attribute of "binary data" type, how can I structure my data tables to allow multiple images per record?

Hi YS Yeo,

Not Possible to use more than 1 attribute of type Binary Data in Outsystems.

Outsystem Recommendation : Depending on your requirements, either change the data type of one of these attributes or create a new entity and move one of these attributes to this new entity.


Thus Only way to do so is create a second entity that connect to the main entity with a relation one-to-many, and in the second entity you can save how many images you need (one for row) and keep linked to the first by the ID.

I hope this help :)


Thanks! I tried but I can't get the "Image Content" properties right in the interface.

How do you join the 2 entities in an aggregate?

Hi,

You just need to add a new source. Regarding how to have multiple images, In assif example another way of having multiple images is by having a ProductId on the Bin table

You should follow this training it will answer all those questions you have right now.

Regards,

Marcelo

Solution

Hi 

You need a 1 - many relationship between Product and ProductPicture.  In this way you can store more than one image (ProductPicture) for an entity record (say Product).



Regarding joining the entities in an aggregate 

Going through the course Marcelo has suggested will help you clear your concepts. 


Hope this helps !!! 

Solution

Amal Raj wrote:

Hi 

You need a 1 - many relationship between Product and ProductPicture.  In this way you can store more than one image (ProductPicture) for an entity record (say Product).



Regarding joining the entities in an aggregate 

Going through the course Marcelo has suggested will help you clear your concepts. 


Hope this helps !!! 


Okay I structured data tables and aggregates accordingly. But how do I point the image widgets correctly? See picture (: My simple oml is also attached for reference.


Hi YS Yeo,


To model it that way, you need a 1-to-many relationship (1 record, multiple images).

You can see here how to apply this pattern and achieve what you pretend.

YS Yeo wrote:

Amal Raj wrote:

Hi 

You need a 1 - many relationship between Product and ProductPicture.  In this way you can store more than one image (ProductPicture) for an entity record (say Product).



Regarding joining the entities in an aggregate 

Going through the course Marcelo has suggested will help you clear your concepts. 


Hope this helps !!! 


Okay I structured data tables and aggregates accordingly. But how do I point the image widgets correctly? See picture (: My simple oml is also attached for reference.


Hi 

On approach could be to use a list of (image widgets) instead of separate image widgets as you can have many records of  Photos associated with one record of Entity1 .

Write an aggregate to fetch the photos related to a record of Entity1 and bind it to the list.

Do accept my solution if this solves your problem. 



Amal Raj wrote:

YS Yeo wrote:

Amal Raj wrote:

Hi 

You need a 1 - many relationship between Product and ProductPicture.  In this way you can store more than one image (ProductPicture) for an entity record (say Product).



Regarding joining the entities in an aggregate 

Going through the course Marcelo has suggested will help you clear your concepts. 


Hope this helps !!! 


Okay I structured data tables and aggregates accordingly. But how do I point the image widgets correctly? See picture (: My simple oml is also attached for reference.


Hi 

On approach could be to use a list of (image widgets) instead of separate image widgets as you can have many records of  Photos associated with one record of Entity1 .

Write an aggregate to fetch the photos related to a record of Entity1 and bind it to the list.

Do accept my solution if this solves your problem. 




Thanks. I did what you said about the list but still doesn't work... haha


Hi 

An approach could be to 

1) Create a web block (ImagesWebBlock) which takes as input an Entity1 identifier and fetches all the images related to that Entity1 ID. (ie filter it by the input Entity1 ID)

See the web block Element Tree 


2) Create a screen where you instantiate the web block for a particular Entity1 record. 

Hope this help you enough to solve your problem.