13
Views
6
Comments
Solved
Uploading files in native app
Question

Hi,

https://success.outsystems.com/Documentation/10/Developing_an_Application/Design_UI/Inputs/Enable_End-Users_to_Upload_Files 

According to this documentation, when uploading files, a local variable needs to be created on that particular screen. Is there a reason for doing this? Because all the along in my forms, i do not create a local variable to hold binary data such as photos. I just set the image content of my upload widget as 

SyntaxEditor Code Snippet

GetItemsById.List.Current.Items.Photo

Is there a difference when using the local variable and using my method? 

mvp_badge
MVP
Rank: #89
Solution

Hi Jolene,

No there is no such difference. The mandatory for using the upload widget is to bind/map a variable place holder of binary data type to hold the upload binary content i.e. the upload widget can be mapped with local variable or it can be mapped with record attribute of an Aggregate Output List; both the Variables are of binary type.

As per the documentation (mentioned Link) the upload widget is mapped with the binary type Local variable because within the User record, we don't have any binary data type attribute available and as per the outsystems best practice the binary value must be stored in separate (extended) table rather than in the main table (it is good practice to have a separate Entity that contains just an Id and the Binary data).


Hope this helps you!


Regards,

Benjith Sam

Rank: #772

Jolene Kwek wrote:

Hi,

https://success.outsystems.com/Documentation/10/Developing_an_Application/Design_UI/Inputs/Enable_End-Users_to_Upload_Files 

According to this documentation, when uploading files, a local variable needs to be created on that particular screen. Is there a reason for doing this? Because all the along in my forms, i do not create a local variable to hold binary data such as photos. I just set the image content of my upload widget as 

SyntaxEditor Code Snippet

GetItemsById.List.Current.Items.Photo

Is there a difference when using the local variable and using my method? 

Their is not difference between using a local variable and a entity attribute of same datatype.

If you use 

GetItemsById.List.Current.Items.Photo

It will first set the image of upload widget stored in database and if you change the image and update the data base it will get updated.

But if you use local variable, you have to manually assign the value from Db to local variable  and vice versa on both actions(fetching and saving to DB). 


Hope this helps you.


Thanks,

Preeti Kumari