Greetings,
Scenario: When a new item is added to a SP list via the app, a flow kicks off creating a supporting folder in a SharePoint doc library. The filename is the key id for both items. Within the doc folder, files and photos will be stored.
Question: How can I retrieve the filename for the last item (photo) in the folder so, if a user 'Edits' an item via the app and adds a new photo, the filename will be based on the last item in the library. For example, I currently have
Collect( PhotoList, {Photo: imgMediaPhotos.Image, Filename: Concatenate(photoName.Text, Text(CountRows(PhotoList)+1), ".jpg")} )
An example of the folder filename is:
And the respective files in the folder will be named accordingly:
With the example above, if a user Edits a record and adds a new photo, the new photo filename should be 0159_0035.700A-3
The method I used for adding photos was based on this video by @paul_culmsee
Thank you!
Solved! Go to Solution.
Hoping to raise this back up to the top and attract the attention of a PA wizard to help me solve.
Thanks!
HI @tianaranjo,
Could you please share a screenshot about your flow's configuration?
Do you want to retrieve the file name for the last item (photo file) in the folder within your flow or app?
Further, could you please show more details about the PhotoList collection that you mentioned?
If you want to retrieve the file name for the last item (photo file) in the folder within your app, you must find all photo files have been existed within the corresponding folder (e.g. 0159_0035.700A ) firstly.
I assume that you want to add a new photo file within the 0159_0035.700A folder, I have made a test on my side, please take a try with the following workaround:
Set the OnVisible property of the first screen of the app or the OnSelect property of Button control to following formula:
ClearCollect(
PhotoCollection,
SortByColumns(
Filter(Reporting,StartsWith('{FilenameWithExtension}',"0159_0035.700A"),EndsWith('{FilenameWithExtension}',".jpg")),
"ID",Ascending
)
)
Note: The Reporting represents the SP library within my SP site.
On your side, you should type the following:
ClearCollect(
PhotoCollection,
SortByColumns(
Filter(YourSPLibrary,StartsWith('{FilenameWithExtension}',"0159_0035.700A"),EndsWith('{FilenameWithExtension}',".jpg")),
"ID",Ascending
)
)
Set the OnSelect property of the "Collect" button to following formula:
Collect( PhotoList, {
Photo: UploadedImage1.Image, /* On your side, it is imgMediaPhotos.Image */ Filename: Concatenate(First(Split(First(PhotoCollection).'{Name}',"-")).Result,"-" ,Text(CountRows(PhotoCollection)+1), ".jpg")
} )
My SP library structure as below:
When I click the "Collect" button, the PhotoList collection as below:
Best regards,
Kris
Hoping to raise this back up to the top and attract the attention of a PA wizard to help me solve.
Thanks!
HI @tianaranjo,
Could you please share a screenshot about your flow's configuration?
Do you want to retrieve the file name for the last item (photo file) in the folder within your flow or app?
Further, could you please show more details about the PhotoList collection that you mentioned?
If you want to retrieve the file name for the last item (photo file) in the folder within your app, you must find all photo files have been existed within the corresponding folder (e.g. 0159_0035.700A ) firstly.
I assume that you want to add a new photo file within the 0159_0035.700A folder, I have made a test on my side, please take a try with the following workaround:
Set the OnVisible property of the first screen of the app or the OnSelect property of Button control to following formula:
ClearCollect(
PhotoCollection,
SortByColumns(
Filter(Reporting,StartsWith('{FilenameWithExtension}',"0159_0035.700A"),EndsWith('{FilenameWithExtension}',".jpg")),
"ID",Ascending
)
)
Note: The Reporting represents the SP library within my SP site.
On your side, you should type the following:
ClearCollect(
PhotoCollection,
SortByColumns(
Filter(YourSPLibrary,StartsWith('{FilenameWithExtension}',"0159_0035.700A"),EndsWith('{FilenameWithExtension}',".jpg")),
"ID",Ascending
)
)
Set the OnSelect property of the "Collect" button to following formula:
Collect( PhotoList, {
Photo: UploadedImage1.Image, /* On your side, it is imgMediaPhotos.Image */ Filename: Concatenate(First(Split(First(PhotoCollection).'{Name}',"-")).Result,"-" ,Text(CountRows(PhotoCollection)+1), ".jpg")
} )
My SP library structure as below:
When I click the "Collect" button, the PhotoList collection as below:
Best regards,
Kris
@v-xida-msft I missed this somewhere along the way. Going to try this now. I'll accept once I have it working. Thank you!
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
252 | |
122 | |
84 | |
83 | |
67 |