21
Views
7
Comments
Solved
How to display an image stored in a database
Application Type
Reactive

I upload image files (logos), then I also want to show them in the table, not only filenames, but the pictures themselves. How could I do that? 


Screenshot (422).png
Champion
Solution

Hello

You can simply use image widget and bind the binary data to it

  • Select Binary in Type
  • In Image content bind the binary data from database table.

I am attaching an example for you hope it helps

https://personal-ejuytnht.outsystemscloud.com/TestAppForm/Bulkactionswithfilters?_ts=638334404187859540

I hope this helps
Best Regards
Tousif Khan

Sample_ImageinTable.oml

Thanks! I've already found the solution.

Champion

I am glad you found it :)

Anyways Thanks for asking here

Tousif Khan

Thanks again. 

I got the principle and did that as  a single action: file name, file content are written into a database and are retrieved. However, when I am trying to put the same 'upload' widget on existing form with some other text inputs, it doesn't work. I don't know what I should change on 'submit' button action. An image is being added to the database as two fields: filename(txt), filecontent(binary data). Now when I click on 'save' it only writes those text fields values, no data is being written onto the 'filecontent' field.

On the screenshots below are 1 - the form interface with text inputs and upload widget; 2 - the logic on 'save' (submit) button 

Champion

Hello

where you are keeping the identifier of your file, or you have them master data identifier in your image data aggregate

You need to check if. you are saving the data correctly, binding the data directly to an aggregate and fetching is a bit easy process

If you re using local variable then you need to sign it to the save action or using an assign widget bind the data just before the save action

Have a look to sample and see if it helps- 

https://personal-ejuytnht.outsystemscloud.com/TestAppForm/Products

Thanks
Tousif Khan

Sample_ImageinTable_V2.oml

Oh, it is easier than I thought. What I did is I added the Assign widget to the logic (which I haven't thought about earlier) and created an assignment for the variable filename. First, I just mixed up those two things which were a data value itself and a variable (Banks.Filecontent) where I should put it, but then I changed them in the right order. Thank you for quick replies!

Champion

You are welcome :)

Happy to help you with this

Thanks

Tousif Khan

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