cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
maxtarneberg
Level: Powered On

Customise Site Inspector photo filename and ID recording

Hi There,

 

Using the Site Inspector template the photos are saved in a OneDrive Folder and an Excel sheet records the details.

 

Great, however:

 

1) The Filename given is gibberish and not particularly helpful when looking through the folder at images. Is there any way to define the filename at the PA end to maybe cocatenate some textbox inputs to make the resultant filename (and excel listing) more meaningful?

 

2) For some reason I am always getting "5" as a file ID in the excel sheet and have no idea why?

 

Can you take a look at this code below for the OnSelect of 'Save' button and see how I can resolve these two issues please?

 

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

Note "Label10" contains the value that I wish to be given as the ID, which is carried forward from a selected item in a gallery (its not 5 btw) ideally to link the photo with that item (not to be mistaken with PhotoID which is unique to each individual photo)

 

Many Thanks for your help

Max

 

5 REPLIES 5
Community Support Team
Community Support Team

Re: Customise Site Inspector photo filename and ID recording

Hi @maxtarneberg,

 

1). 

Currently I can't find a way to change the image name saved by the camera control within PowerApps, the image name should be saved automatically.

And here I suggest to change the name manually, for both the Excel data and the Image in the image folder.

Besides, I think it is a good idea for the camera control to have a property to rename the image saved. You could add an idea in PowerApps Ideas forum.

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

2).

The formula in my sample app is actually:

If(NewRecord,Navigate(NewInspectionScreen,ScreenTransition.Fade),
If(CountRows(CameraPhotos)>=1,UpdateContext({AddPhotoSmiley Tongueatch(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({AddPhotoSmiley Tongueatch(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({AddPhotoSmiley Tongueatch(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({AddPhotoSmiley Tongueatch(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({AddPhotoSmiley Tongueatch(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({AddPhotoSmiley Tongueatch(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({AddPhotoSmiley Tongueatch(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))

So if you add a new record, the id field would match the last record in the sample table which is 5.

 

In your formula, did you add the Label10 by yourself?

 

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
maxtarneberg
Level: Powered On

Re: Customise Site Inspector photo filename and ID recording

Hi @v-monli-msft,

 

Many thanks for your reply.

 

1) I don't feel that manually changing file names is viable in my situation, especially in two locations that must match, programing should automate things IMO, and I am amazed this isn't already possible! Perhaps there is a FileName: function? However, I wouldn't know where to insert that within the code.

 

2) Yes, I changed the code to include Label 10. I added another tier/dashboard to add multiple inspections against a specific site, which I think has complicated things.

So, is record 5 the last record I selected before changing the code perhaps?

I will revert to the original code as you suggest, and hopefully this will help.

 

Many many thanks for your help

Max

maxtarneberg
Level: Powered On

Re: Customise Site Inspector photo filename and ID recording

Hi @v-monli-msft

 

I changed the code to:

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

...this reflects that I actually want the ID to come from BrowseGallery1, not Gallery3, but with either choice I am still getting 5.

This is why I'm trying to force it to use a label value to test if it changes at all, but no luck!

 

Thanks again

maxtarneberg
Level: Powered On

Re: Customise Site Inspector photo filename and ID recording

@v-monli-msft

 

I wonder if you could help me, I am still stuck on this issue. 

 

Much appreciated

Max

LL
Level: Power Up

Re: Customise Site Inspector photo filename and ID recording

Why this template is misleading? Template images have nice naming but all new files have just long nonsense. 

Could this be fixed? 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 81 members 4,580 guests
Please welcome our newest community members: