cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powaya
Helper I
Helper I

How to I program an icon in my power app to trigger a click of my camera control?

In my app I have a camera control and a camera icon. I want the user to be able to click on a camera icon so that it triggers the same effect as clicking on the camera control. The OnSelect code for the camera control "Camera1" is the following:

 

Set(
    varName,
    GUID()
);
Collect(
	colImages,
	{
		DisplayName: varName & ".jpg",
		Id: varName & ".jpg",
		Value: Camera1.Photo
	}
);

 

Meanwhile, the OnSelect code for the camera icon is the following:

 

Select(Camera1)

 

The OnSelect code for Camera1 works perfectly, but for some reason, whenever the user click's on the camera icon, it takes a blank photo and fails to add it to the attachment list.  My app is modeled after this Reza Dorrani youtube video. Does anyone know why that my Select(Camera1) code for the camera icon is not working? How can I get this camera icon to behave exactly the way Camera1 does?

 

BeckTableImageUpload.JPG

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @powaya ,

Please have a look at the first part of this blog of mine as I use a camera button on it to initiate an action. I capture the camera Stream, so please see if this suits your model.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

WarrenBelz
Super User
Super User

Hi @powaya ,
Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz ! Thanks for your response. I'm new to this so I had a hard time understanding what the code in your  “Camera” icon OnSelect is doing. I'm curious why clicking on my camera icon can't simply trigger the OnSelect code of my Camera1 using the code below (note: Camera1 is the beige block at the top of my screenshot, above my camera icon)

 

Select(Camera1)

 

Hi @powaya ,

My blog was simply an example of one way of achieving the result. You can certainly click on the camera control, but your post had an icon, so I assumed that is how you wanted to trigger it.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

powaya
Helper I
Helper I

@WarrenBelz I want clicking on both of these to do the same thing. The code for clicking on the image preview (I pasted it below) works perfectly. Now I want clicking the camera icon to mimic that same action. What's the best way to do that?

 

BeckTableImageUpload2.jpg

 

Set(
    varName,
    GUID()
);
Collect(
	colImages,
	{
		DisplayName: varName & ".jpg",
		Id: varName & ".jpg",
		Value: Camera1.Photo
	}
);

 

@powaya ,

Add to the OnSelect of the Camera control.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz That's where that code currently resides, on the OnSelect of the camera control. But when I add that same code to the OnSelect of the camera icon, then clicking on the camera icon simply adds an additional copy of the most recent photo that was taken, as opposed to taking a new photo. Do you know why that is?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,564)