cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mgodby
Helper V
Helper V

Why does my image get saved into a collection when doing an onSelect on the camera object but not on an icon?

I have an app that lets me save the picture taken by a camera. The strange thing is how when I run this code:

 

ClearCollect.png

It will only work on the camera object's OnSelect. I have a camera Icon here that does the same thing but for some reason it doesn't work.

 

CameraIcon.png

When I click the OnSelect for the camera object, my SharePoint List gets updated correctly.

 

SharePointList.png

But when I do an OnSelect on the camera icon, it doesn't work and is blank. What I don't get is they're both essentially doing the same thing; running the same code. But why does this work on the OnSelect for the camera object but not for the icon?

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @Mgodby ,

I have the answer as a solution for you in that you will stop trying to solve it.

As I suspected, the Camera.Photo does not happen until you "click" the camera control.
I created a new control and tried firstly clicking the button before the control and as you have experienced, got an invalid record.

I then clicked the camera (which had no other code on it to Collect), then clicked the button and got a photo.

There is also another property called .Stream, but it seems to work in the same way.

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more. It also closes the item.

 

 

 

 

View solution in original post

6 REPLIES 6
WarrenBelz
Super User III
Super User III

Hi @Mgodby ,

There must be something else in the background as the code is simply adding the photo from the camera to a collection within the app - it is not writing anything to SharePoint. I use almost exactly the same principle and have had about 30,000 photos written to SharePoint Library with a Flow from the collection.

The button should work as well - however we need to find what is writing to SharePoint - by the looks of your code, it is writing the JSON IncludeBinaryData conversion or similar to a multi line text field in a list. Check what other things are being triggered - can you give me a screen shot of what you are dong?

 

The code that sends them to SharePoint works fine, it's only when I use the icon does the url stay blank. When I click the camera it works but when I click the icon it remains blank. I am able to pull the images from my SharePoint list and view them in a gallery so they do work. I've attached the code that sends all this to SharePoint. I'd be surprised if this is the issue since it works fine when I click the camera, it also runs when I use the icon but the image url is just blank. The camera's OnSelect and the icon's OnSelect are identical.
WarrenBelz
Super User III
Super User III

Hi @Mgodby ,

Sorry I will retract the SharePoint bit - misread your message.

However I believe possibly that to take a picture, you have to select the camera control. I have always used this anyway and it has been intuitive for users without any instructions.

Any reason for wanting to use a button? I will also give this a test on my end.

WarrenBelz
Super User III
Super User III

Hi @Mgodby ,

I have the answer as a solution for you in that you will stop trying to solve it.

As I suspected, the Camera.Photo does not happen until you "click" the camera control.
I created a new control and tried firstly clicking the button before the control and as you have experienced, got an invalid record.

I then clicked the camera (which had no other code on it to Collect), then clicked the button and got a photo.

There is also another property called .Stream, but it seems to work in the same way.

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more. It also closes the item.

 

 

 

 

View solution in original post

I think you're right. It is more intuitive to just click the camera. It really shouldn't be an issue since they can still take a photo and do all they need. I guess I was just confused as to why this was occurring since they both have the same code in OnSelect. Thank you for all the help.

summitb
Power Participant
Power Participant

You can try using Steam like in following video.
https://youtu.be/QNOEi-loNz8

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (59,316)