cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Upload Picture in One Drive

My user and I are encountering a issue while uploading picture through the application.

 

Here is architecture of the app:

Records including the picture (Picture are loaded using the AddMedia Button) when created got loaded in a collection (1 collection for the record and 1 for the picture with a common column to associate the record with the picture).

Once the user finish to enter all the records he wants to post, he user can submit all of the record he created and those got send for the value in SQL Server, and for the Picture in One Drive with Excel file to provide the link.

 

All the record got correctly send to SQL Server but the picture are behaving weirdly.

Basically it loads the picture the user submit but as well other picture that were not part of the user selection (picture that are on his phone or his computer) or the picture the user select got post twice while the user perform only one action.

 

As far as i know you can only submit one picture at a time using the AddMedia button.

How come by submitting one picture multiple got submit ?

 

The issue happen both on Computer (web Browser) and Phone using the PowerApps application (Android and Iphone)

Here is some scenario i encounter today:

1. Upload one picture and it upload as well a picture i upload last Sunday into the collection 

2. Upload  1 picture in the collection it shows correctly but once i post it in one drive it show the picture twice with 2 different ID like i upload the picture twice while i only perform the action once

 

Does anyone got a similar issue ?

 

I attached some screen picture.

 

 

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Upload Picture in One Drive

Hi @Romain_Pham ,

Could you please show more details about the formula you used to upload pictures to your OneDrive folder?

Do you use a ForAll function when you uploading pictures to your OneDrive folder?

Further, do you want to patch the collection back to your OneDrive folder?

 

Please consider provided more details about the formula you used in your app, then we could provide a proper workaroud for you. Actually, based on the needs that you mentioned, I think it is not necessary to set up two collections separately to store the records and image data, instead, I think single one collection could achieve your needs.

On your side, you could consider add a single one collection to collect the records and image data. Add a image column in this collection to store the taken picture data. When patching collection data back to Excel table, please use the following formula:

ForAll(
       CollectionData,
       Patch(
             'Excel Table',
              Defaults('Excel Table'),
              {
                Column1: ColelctionData[@Column1],
                Column2: ColelctionData[@Column2],
                ...
                ImageColumn: ColelctionData[@ImageColumn],
                ...
              }
       )
)

Within your Excel table (hosted in OneDrive), you should also add a image type column to store the image data. Please refer to the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/tutorial-working-with-images-in-excel

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Upload Picture in One Drive

Hi @v-xida-msft  thanks for your Reply.

 

To answer your first recommendation i have to actually set up 2 collection in order to be able to have multiple picture for 1 record.

Example: they identified one issue and attached 2 pictures.

Anyway i need to separate the records and picture as record go in SQL and Picture are host in Onedrive with Excel that allows to make the link.

As well I am not looking for an answer on how to post picture in OneDrive i manage that and it works, but more about why the picture i am posting got sometimes duplicated or even retrieve former pictures that i have taken few days back.
While i am writting this message i am thinking as we have sometimes network issue maybe some of the temporary collection didn't got cleared correclty after posting pictures and still hold old pictures then got posted in the same time as the new one.


Here some details about the code:

When user upload pictures to the collection:

 

"

If(IsBlank(New_ID_Event),
Set(New_ID_Event,Text(Left(_myProfilEmail,4)&Text(CountRows(Filter(Findings_List, Auditor = _myProfilEmail ))+CountRows(FindingsCollection)+1))))
;
If(
!IsBlank(AddMediaButton1_1.Media),
Collect(
ItemsCollection,
{
PhotoId: Text(CountRows(SitePhotos)+CountRows(ItemsCollection)+1),
Photo: AddMediaButton1_1.Media,
ID_Event: New_ID_Event,
Filename: Concatenate(Text(CountRows(Findings_List)+CountRows(FindingsCollection)+1),"-",Text(CountRows(SitePhotos)+CountRows(ItemsCollection)+1),".jpg")
}
)
);
Reset(AddMediaButton1_1)
"

This is the part of the code that post both collection (records and Picture) in their respective data source:

"If(
IsEmpty(FindingsCollection),
UpdateContext({msg_visible_EmptyCollection: false});
UpdateContext({msg_visible_EmptyCollection: true}),
Collect(
'[dbo].[Finding_db]',
FindingsCollection
);
If(
!IsEmpty(ItemsCollection),
ForAll(
ItemsCollection,
Patch(
SitePhotos,
Defaults(SitePhotos),
{
PhotoId: PhotoId,
Photo: Photo,
ID_Event: ID_Event
}
)
);
Clear(ItemsCollection)
);
Clear(FindingsCollection);
Navigate(
Record_New_Audit,
ScreenTransition.None
)
)"

 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (7,513)