One Save Action creats multiple records

One Save Action creats multiple records

I created an action to upload a picture. Everything is working fine, but when it refreshes the list of records, instead of creating just one records, it creates a record for every user in the system. I have a screenshot of the action below.

Hi Michael,

Could you / Did you  perform a Simple Query Test on the AssetsPictures Entity?
There could be a join problem on the preparation query of the List screen.

This may not be a solution to you problem,
I noticed that you are using the File Upload widget and have Ajax Refresh (just before end).
Make sure that the Button (that calls the action) has its method property set to Submit (This is necessary for the upload widget to work correctly).
The Ajax Refresh is not required as it will be ignored.

Can you provide the oml?

- It could be that when refreshing the table, you will trigger the action, because of some onchange event?

- Furthermore, are you sure it creates multiple records?
perhaps your query is having a wrong join, hence you will see tons of records, instead of the expected rows.

Statler,  can't say for certian that it is "creating" mutliple records, and I am just seeing a bunch of rows of one record.

However, I still am at a loss of what I need to do to fix the issue, so I do thank you for assisting me in this. I have the oml attached.

Hi Michael,

From my quick inspection, I think you are uploading the picture correctly.
Your problem seems to be on the Preparation>GetAssetsPictures.

You are fetching all pictures for all assets. Change your GetAssetsPictures query in the Praparation to:
  • Receive the AssetId by parameter
  • You only need the AssetPictures entity in the 'Entities' folder
  • Change your condition to filter by 'AssetPictures.AssetId = AssetId' (the AssetId you receive by parameter)

BTW, your application looks great. Check out these UX videos at the academy for some tips on how to group information to make it easier for users to read.
I confirm what João said. Just add the AssetId and check if it shows what you wanted.

Joao and Nuno, I tried that but still had the same issue. I spent a while playing with it further and was able to get it working. I had to add the condition 'AssetsPictures.UploadedBy = User.Id'.

Thanks for your help
Hi Michael,

Why do you have the User entity there? That's the reason why it is showing an asset picture as many times as users you have.

EDIT: Better said, the reason is you don't have a condition for joining the User entity so this means you have what is called a cross join. Simply remove and add the User entity if you really want it and the condition will show up.