100
Views
8
Comments
Solved
Store Image in Entity
Question
Application Type
Reactive
Service Studio Version
11.10.7 (Build 37468)

Hello



I am new to Outsystems and am currently working my way through the guided paths. I have now already read some entries about "Image and Entities", but I do not manage to solve my problem.

I have a page with the overview of all tasks:

On the Taks_NewEdit page, I now want to be able to add an image to each task and save it.

I have not managed so far to save the image in the provided entity "TasksImage". Can you tell me what I am doing wrong?



Tasks.oml
2021-01-04 08-13-48
Toto
 
MVP
Solution

Hi Benjamin,


Looking at your action, you didn't save the image to the entity (check screenshot below)

or you can put in the Task_CreateOrUpdate Action

2021-01-22 12-09-19
Benjamin Schwendinger

Thank you Toto, it works now.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Benjamin,

I'm not sure I understand where your problem is. In your Save Action, there's no attempt to save the image data, so in which ways did you "not manage"?

2021-01-22 12-09-19
Benjamin Schwendinger

Hi Kilian

I rebuilt this this morning and translated it from German to English, thought it might be easier.  I created a new server action and my attempt looked something like this:


And I did not manage to fix the error. I did it the way Toto suggested and it now works. Hope I´m on the right way now.

Greets Benjamin

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

You need to pass an Entity Record as input to the CreateOrUpdate Entity Action, but you supplied a Task Identifier, so that's indeed not going to work.

Note also that it pays off to have consistent naming of your variables, so something that's a Task Identifier should be named TaskId, not TaskImage.

2021-01-04 08-13-48
Toto
 
MVP
Solution

Hi Benjamin,


Looking at your action, you didn't save the image to the entity (check screenshot below)

or you can put in the Task_CreateOrUpdate Action

2021-01-22 12-09-19
Benjamin Schwendinger

Thank you Toto, it works now.

2020-06-04 15-38-19
Samiksha Manekar

Hi Benjamin,

you have to add TaskImageId to Tasks Entity. I attached Oml .please check.

Hope this works.

Tasks.oml
2021-01-22 12-09-19
Benjamin Schwendinger

Hello

I've tried this before as well, but I saw in a course that they use a one to one connection for the images and not a one to many. As I understand it, I need the One To Many connection if I want to attach multiple images to a task, and the One To One connection if I want to attach only one image. Am I correct?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Yes, if you need just a single image, you can use a 1:1 relation. This can be done by:

  • Using an existing Identifier for primary key, or;
  • Adding a foreign key to the parent Entity.

This as opposed to a 1:many relation where you add the parent Id to the child Entity.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.