Hi!
I have made an app for equipment inspection. The first screen shows a gallery that preview each submission, and a form that has all the information they filled out once you click it from the gallery. But I am trying to add the option to upload images before each inspection is submitted. Instead of having the camera in the first screen I would like to have it at the very end, and once it's submitted have the images avaiable in the form of the first screen. Is that possible? I've been trying to see how to do it, but i'm not able to figure it out. Attached is a picture of my first screen.
Thanks for your response!
My data source is a SP List. I was hoping their was a way to either attach photos or capture photos at the end of each inspection. I'd like to add that option on screen 5, and once they click the submit button all the content for that piece of equipment will be avaible to view in the Intro screen (where I have my gallery and edit form). I have attached how screen 5 looks.
Hi @Anonymous ,
Could you please share a bit more about the data source you used within your app? Is it a SP List?
Do you add a Edit form within your New Inspection screen to collect the user's input?
Further, do you want to capture the pictures using Camera control?
Currently, within PowerApps, there is no way to upload pictures captured via Camera control to a data source directly.
If the data source you used within your app is a SP List (use SP List to store the Inspection), I think it is not necessary to add a Camera control to capture the picture files, the Attachments control could achieve your needs.
On your side, within the Edit form in your New Inspection screen, you could enable the "Attachments" field (data card), then you could use the Attachments control to capture files from your local device. When you submit the form, the picture files attached within the Attachments control (in your Edit form) would be saved along with the Inspection record into your SP list as attachments.
More details about the Attachments control in PowerApps, please check the following article:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-attachments
If the data source you used within your app is not a SP list, I afraid that there is no direct way to achieve your needs. As an alternative solution, you could consider save the pictures captured via Camera control into your SP Library along with a unique file name using the combination of PowerApps and Microsoft Flow. In addition, you need to create a new SP list to store the Inspection record ID and unique file name of the uploaded pic files.
More deetails about uploading files captured via Camera control from PowerApps to SP Library, please check the following blog:
https://www.techmikael.com/2017/05/an-even-more-clever-workaround-for.html
Then within your first screen, you could look up the pic files from your SP Library based on the Inspection Record ID. You could add another Gallery (Gallery2), and set it to Photo Layout. Set the Items property of the Gallery (Gallery2) to following:
Filter( 'YourSPLibrary', 'File name with extension' in Filter('YourNewList', InspectionID = Gallery1.Selected.ID).UniqueFileName )
Note: The InspectionID represents the column in your New SP list, which used to store the ID value of the Inspection record. The UniqueFileName represents the column in your New SP list, which used to store the unique file name of the uploaded picture files. The Gallery1 represents the Gallery control in your first screen, which used to show all Inspection Submissions.
Within the Gallery2, set the Image property of the Image control to following:
ThisItem.'Link to item'
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
No it's okay I can add another gallery. I won't be having an image for every item. I'll be adding the camera in the very last screen and if the user wants to add 2-3 pictures i wanted to give them the option to do so. But wanted to make sure they show up in the first screen with the corresponding equipment.
I assume the Inspections List gallery contains the records being inspected and you want the pictures to be attached to one record in that gallery. If that's the case I would expect you'll need to add another gallery to hold the pictures. I don't think you can nest a gallery within a gallery.
I don't think the problem is going to be getting the pictures to show. The problem is that I think you have multiple items in the Inspection list and you want to attach different pictures to each item in the list. Its a many to many relationship that is going to be very difficult to implement.
You could add an additional field to the picture collection when you take the pictures that holds an identifier for the record you want to relate them to. Then in the second gallery filter the items property of the pictures based on the identifier of the selected record in Inspection list.
How do I set the items property of the gallery to mypics? It currently has InspectionList there. And for the image control I would add the one that is under Media, correct?
1) Add the Camera control to the third screen.
2) Set the Camera control's OnSelect to Collect(mypics,{Title:TextInput1.Text,Pic:Camera1.Photo}) . Each time a picture is taken it will be added to the mypics collection.
3) Set the Items property of the Gallery on Screen1 to mypics. And the Image control in the gallery to ThisItem.Pic. Since the collection is visible to the whole app the pictures will appear in the Gallery as soon as they are added to the collection and you navigate back to the screen.
I understand. Would you mind showing me the way you first recommended? Having the option of taking the picture with the camera and having them stored in the first screen.
Thanks!
I'm sure there are ways to accomplish that. But its much more difficult than manipulating Camera photos. I can't give you a quick easy way to do it or point you at a blog that details the steps.
Thanks for your response. So theres no way to have an option to attach images at the end of every inspection, and once it's submitted be able to view them in the form?
The problem with uploaded images is that the binary of the image isn't actually in PowerApps, its kept in the browser's cache. As I result I've never seen a way to get the actual contents of the image to store it in a collection. You can display it based off the URL of the upload location, but that normally doesn't happen until you save the record.