cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Running Camera in PowerApp turned all white!

I am currently using the PowerApp provided 'Site Inspection' as a base to create a similar App and when I get to Camera screen on my own App it went all white and on the 'Site Inspection' App it worked exactly how I wanted. But the code are pretty much the same, I don't know what went wrong? 

Please help!!!!

 

I don't know it if crash or not?! But the 'Site Inspection' went fine?!

 

The process I wish to achieve is: 

Take a photo and it auto appears in the bottom gallery on the same screen and if I think its ok I submit them by click 'Save' button.

 

The only difference in code is on the 'Save' button.

My code is :

If(IsBlank(record.ID),
    Navigate(NewSiteObservation, ScreenTransition.Fade),
    If(!IsBlank(LookUp(CameraPhotos,PhotoId=0,PhotoId)),
        Collect(SitePhotosCollect,{SiteLocation:SiteMonitoringGallery.Selected.Title,PhotoId:Value(Max(SitePhotosCollect, PhotoId)+1),Photo:LookUp(CameraPhotos,PhotoId=0,Photo),Note:Text(LookUp(CameraPhotos,PhotoId=0,Note))}));
    If(!IsBlank(LookUp(CameraPhotos,PhotoId=1,PhotoId)),
        Collect(SitePhotosCollect,{SitLocation:SiteMonitoringGallery.Selected.Title,PhotoId:Value(Max(SitePhotosCollect, PhotoId)+1),Photo:LookUp(CameraPhotos,PhotoId=1,Photo),Note:Text(LookUp(CameraPhotos,PhotoId=1,Note))}));
    If(!IsBlank(LookUp(CameraPhotos,PhotoId=2,PhotoId)),
        Collect(SitePhotosCollect,{PhotoId:Value(Max(SitePhotosCollect, PhotoId)+1),Photo:LookUp(CameraPhotos,PhotoId=2,Photo),SiteLocation:SiteMonitoringGallery.Selected.Title,Note:Text(LookUp(CameraPhotos,PhotoId=2,Note))}));
    If(!IsBlank(LookUp(CameraPhotos,PhotoId=3,PhotoId)),
        Collect(SitePhotosCollect,{PhotoId:Value(Max(SitePhotosCollect, PhotoId)+1),Photo:LookUp(CameraPhotos,PhotoId=3,Photo),SiteLocation:SiteMonitoringGallery.Selected.Title,Note:Text(LookUp(CameraPhotos,PhotoId=3,Note))}));
    If(!IsBlank(LookUp(CameraPhotos,PhotoId=4,PhotoId)),
        Collect(SitePhotosCollect,{PhotoId:Value(Max(SitePhotosCollect, PhotoId)+1),Photo:LookUp(CameraPhotos,PhotoId=4,Photo),SiteLocation:SiteMonitoringGallery.Selected.Title,Note:Text(LookUp(CameraPhotos,PhotoId=4,Note))}));
    If(!IsBlank(LookUp(CameraPhotos,PhotoId=5,PhotoId)),
        Collect(SitePhotosCollect,{PhotoId:Value(Max(SitePhotosCollect, PhotoId)+1),Photo:LookUp(CameraPhotos,PhotoId=5,Photo),SiteLocation:SiteMonitoringGallery.Selected.Title,Note:Text(LookUp(CameraPhotos,PhotoId=5,Note))}));
    If(!IsBlank(LookUp(CameraPhotos,PhotoId=6,PhotoId)),
        Collect(SitePhotosCollect,{PhotoId:Value(Max(SitePhotosCollect, PhotoId)+1),Photo:LookUp(CameraPhotos,PhotoId=6,Photo),SiteLocation:SiteMonitoringGallery.Selected.Title,Note:Text(LookUp(CameraPhotos,PhotoId=6,Note))}));
    Navigate(EditSiteDetail,ScreenTransition.Fade);Clear(CameraPhotos))

the example 'Site Inspection' code:

If(NewRecord,Navigate(NewInspectionScreen,ScreenTransition.Fade),
If(CountRows(CameraPhotos)>=1,UpdateContext({AddPhoto:Patch(SitePhotos,Defaults(SitePhotos),{PhotoId:Max(SitePhotos,PhotoId)+1,Photo:Last(FirstN(CameraPhotos,1)).Photo,ID:Gallery3.Selected.ID,Note:Text(Last(FirstN(CameraPhotos,1)).Note)})}));
If(CountRows(CameraPhotos)>=2,UpdateContext({AddPhoto:Patch(SitePhotos,Defaults(SitePhotos),{PhotoId:Max(SitePhotos,PhotoId)+1,Photo:Last(FirstN(CameraPhotos,2)).Photo,ID:Gallery3.Selected.ID,Note:Text(Last(FirstN(CameraPhotos,2)).Note)})}));
If(CountRows(CameraPhotos)>=3,UpdateContext({AddPhoto:Patch(SitePhotos,Defaults(SitePhotos),{PhotoId:Max(SitePhotos,PhotoId)+1,Photo:Last(FirstN(CameraPhotos,3)).Photo,ID:Gallery3.Selected.ID,Note:Text(Last(FirstN(CameraPhotos,3)).Note)})}));
If(CountRows(CameraPhotos)>=4,UpdateContext({AddPhoto:Patch(SitePhotos,Defaults(SitePhotos),{PhotoId:Max(SitePhotos,PhotoId)+1,Photo:Last(FirstN(CameraPhotos,4)).Photo,ID:Gallery3.Selected.ID,Note:Text(Last(FirstN(CameraPhotos,4)).Note)})}));
If(CountRows(CameraPhotos)>=5,UpdateContext({AddPhoto:Patch(SitePhotos,Defaults(SitePhotos),{PhotoId:Max(SitePhotos,PhotoId)+1,Photo:Last(FirstN(CameraPhotos,5)).Photo,ID:Gallery3.Selected.ID,Note:Text(Last(FirstN(CameraPhotos,5)).Note)})}));
If(CountRows(CameraPhotos)>=6,UpdateContext({AddPhoto:Patch(SitePhotos,Defaults(SitePhotos),{PhotoId:Max(SitePhotos,PhotoId)+1,Photo:Last(FirstN(CameraPhotos,6)).Photo,ID:Gallery3.Selected.ID,Note:Text(Last(FirstN(CameraPhotos,6)).Note)})}));
If(CountRows(CameraPhotos)>=7,UpdateContext({AddPhoto:Patch(SitePhotos,Defaults(SitePhotos),{PhotoId:Max(SitePhotos,PhotoId)+1,Photo:Last(FirstN(CameraPhotos,7)).Photo,ID:Gallery3.Selected.ID,Note:Text(Last(FirstN(CameraPhotos,7)).Note)})}));
Navigate(EditInspectionScreen,ScreenTransition.Fade);Clear(CameraPhotos))

捕获.PNGThis is how the screen look like. I pretty much copied the example one.

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

Hi @Anonymous,

 

I don't think the two codes here works the same.

I will explain how the code works in 'Site Inspection'.

First, the NewRecord variable, which is used to identify if the current operation is trying to create a new record.

If yes, then NewRecord would be set to true, 

If choose to view any records within the Gallery, this variable would be updated with false.

Then for the save button, when new a record, after Camera has been taken, the save button would first check the NewRecord value to verify if it is trying to new a record, if yes, then it will navigate to the NewInspectionScreen, otherwise(in Eidt mode), it will first update the photo for the Editing record, then naviagte to the editing screen.

 

Here are some suggestions for you to take a try:

1. First verify if the camera control would work, add a camera control, then save it, then using PowerApps Mobile to check if the Camera would work from your side,

2. Share more details about what you would like to achieve,

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hey 

 

I actually made it work on an ipad device. Wasn't too sure why it did not work on my iphone. 

 

The problem I am facing now is after I took the photo and collect them into a collection, how can I submit them into photo library in SP and link to the main SP list contain all the sits information. (in this case I want it somehow include the photos or at least link to them.) I haven't got an idea of how to achieve this. If you have any suggestions, please let me know. 

 

Also, for every site, I require a few progress checklist. I made them as SP list and coded as a form in PowerApp. Submitting the information is ok, but is there any way I can code PowerApp to show this specific checklist has been done or similar idea shows that checklist has been done/reviewed/checked.

 

thank you

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.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (4,948)