Change in image field is not detected on update

Change in image field is not detected on update

  

Hi,

I have created an entity with an image field (binary data type)

I have added a upload widget and have changed the save action to make sure the image field is set to the content of the upload widget.

The image is saved upon clicking save.

So far so good... now i'm editing the record and changing the image.

Upon save, the image is not updated.

I open the record again, change another field in the record and change the image

Upon save, the image is updated.

From this I deduct that the save action is not detecting a change in the record when only updating a binary field. 

How can I solve this?

Best regards,

Peter



The solution depends on how you have it implemented it now.

afaik there is no issue, but it could be caching for example.


Can you share the oml so we can take a peek?


Hi J,

I have attached the oml file.

Problem is in the RequestDraftDetail form.

Best regards,

Peter


Hi Peter Van der Straeten, J is right its a caching issue, Clear the cache and test it will work fine.




Thanks

Rajendra Singh

Hi Rajendra/J,

Being a novice in outsystems, my next question would be to ask you how I'm to achieve that.

The image is already set to "no cache".

Best regards,

Peter

Hi,


you are mixing up some things.

you do a submit but also an ajax-refresh, so that could mix up things in the way you do not want.

I understand the submit, but you can have a workaround for that.

But I try to refresh the screen instead of only the image, ergo instead of end-node a (current screen) with the newly assigned id



Nevermind, still found it, i have to set cache in the form to 0 minutes.

Very strange, since the value was not set, this probably means outsystems has a default value, which is a strange design choice if you ask me.

But i have another question... when i select an image using the file upload... how do i go about immediately showing it on the form. Now the user has to save it, close the form and open it again.

I don't find any way to "do something" after the user selects a file, there don't seem to be a way to couple events to the upload widget.

Thanks,

Peter

Hi J,

Thank you for your reply.

How can i refresh the screen without losing the changes.

Imagine a user changes the input fields, then selects an image, if i refresh the entire screen, will I not loose the changes in the fields?

And even if I don't loose them, how do I do a refresh after selecting the image? I still don't know how to hook events to the upload widget.

Best regards,

Peter


Hi Peter Van der Straeten,

you have two method to show the image on change of upload widget.

1:- write a java script in extended properties(onchange) of upload wigit to show the current image

2:-on change of upload widget write a java script to click a button and on click of that button call a action which will  assign a new image data to that image variable and then refresh the image.


Thanks

Rajendra Singh

Hi Rajendra,

Thank you for the suggestions, but i can't seem to make either one work.

I know how to use extended properties, but I have no clue of what the code looks like that should go in there. 

For option 2, i created an action with a refresh of the image component and managed to execute it by executing a click on the button from javascript, but it doesn't do anything. Maybe it's because the datasource of the image is database.

I would appreciate if you could be more precise.

Best regards,

Peter

Hi Peter Van der Straeten, have you went through https://www.outsystems.com/forums/discussion/21614/showing-image-in-a-variable-to-image-widget/ it might help you to understand.



Thanks

Rajendra

Sorry Rajendra, 

I'm getting nowhere with all this.

I'm just not experienced enough to understand how to apply what is described there to my situation. 

This shouldn't be so difficult.

Regards,

Peter


Hi,

I got a little further again and am able to call an action from an extended property, but now my main trouble lies into refreshing an image.

No matter how I try, the image control is not refreshed after saving a new binary content. I have tried refreshing the image using the refresh action, i have tried refreshing the entire record and then refreshing the image and i have tried any and all combinations of these actions.

It seems like a bug in outsystems to me.

Closing and reopening the form does show the new image, so I know that the new binary data does get saved correctly.

Best regards,

Peter