cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CamCov
Helper II
Helper II

extract title from all items in gallery

Hello, 

I have an app that is used for document handling. The main goal of this question is to search through the current items in a gallery and if the title matches the title of the document in the attachments queue, display a warning message. Please view the picture for more clarity. Currently, I can only check against the first item in the gallery instead of every item.

CamCov_1-1644511217395.png

I am sure this is simple, but I cant figure it out. Any advice would be greatly appreciated!

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User
Super User

@CamCov 

Actually, the picture was more confusing!  Not sure what is what in there or what you have, but in general, your approach is to have a label that has the warning message in it and then, set the Visible property to:

    CountRows(Filter(yourAttachmentsControl.Attachments, StartsWith(Name, yourLabel.Text)))>0

 

This will be true if the label text is in the attachments files names, and thus the warning will be visible.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

CamCov
Helper II
Helper II

@RandyHayes I actually figured it all out and all I can say is thank you for pointing me down the right direction! Final formula that works for me (Or statement not apart of original question)

CamCov_0-1644608726643.png

Thanks again!

View solution in original post

11 REPLIES 11
RandyHayes
Super User
Super User

@CamCov 

Actually, the picture was more confusing!  Not sure what is what in there or what you have, but in general, your approach is to have a label that has the warning message in it and then, set the Visible property to:

    CountRows(Filter(yourAttachmentsControl.Attachments, StartsWith(Name, yourLabel.Text)))>0

 

This will be true if the label text is in the attachments files names, and thus the warning will be visible.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
CamCov
Helper II
Helper II

Randy that was excellent! Even with the confusing picture. Thank you very much!

RandyHayes
Super User
Super User

@CamCov 

Yes, the picture had some lines and such, but not much labeling to explain.  But I was able to read through the post you had to figure out what you needed.

Glad it helped!!!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
CamCov
Helper II
Helper II

@RandyHayes So I may have jumped the gun or just misunderstood. I need the warning to be visible when the 5 digit code of the new document to submit matches any of the five digit codes that have already been added to the folder. I just do not know what to replace "Label17.Text" with to search through all docs already submitted. 

CamCov_0-1644517869698.png

 

RandyHayes
Super User
Super User

@CamCov 

No worries!

So, then you are looking to provide a warning if the user has an attachment in the attachments control that matches something in the other 6 labels you have shown???

I am not sure what Label17 is in your picture and I had assumed that you had the Text formula already doing some of the logic to provide something relevant to the scenario you have.

 

So my question then would be - where are the other "already submitted documents" coming from?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

So the bottom right hand corner is a gallery displaying the contents of a folder in a document library. This filter is applied to get the contents of the folder to display.

->

CamCov_0-1644522006830.png

 

This is a label placed within the gallery to help display the files within ->

CamCov_1-1644522205270.png

 

Hopefully this is more clear now

RandyHayes
Super User
Super User

@CamCov 

Okay...getting closer!

 

SO,  (first - that Or(_galRefresh, !_galRefresh) part of your filter formula should go...it does nothing!) the DocumentType column - is it accurate to say that, if there is a DocumentType.Value of "PSF02" showing in that Gallery, then there IS a PSF02 document already, OR are you showing all document types in that gallery whether the document exists or not?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
CamCov
Helper II
Helper II

The or statement works off a timer to force the gallery to reload the items every 5 seconds simulating an auto refresh for the user. 

 

All items in the gallery are items that have already been uploaded and are present in the doc library, so if PSF02 is showing in the gallery then it is already submitted. Here is an example where only one document has been submitted to that folder so far 

CamCov_0-1644525726658.png

So in this example only PSF02 has been submitted.

 

RandyHayes
Super User
Super User

@CamCov 

Yes, it is true that ANY part of a formula that changes will cause a re-evaluation of the formula - so, assuming your timer is refreshing the datasource - the formula will already re-evaluate and that "true" part (it will always be true) of your filter is not relevant.

As well, if the DataCardValue4.Text changes, then the formula again will re-evaluate.

So...it's just extra stuff in your app and an extra variable.

 

Okay...closer with each post!!  Final question.  Your attachment control is where the user is adding a document.  You then want to have the label show if the document type already exists based on the first part of the file name (good so far?).   My question is...what if they then add another document (i.e. multiple documents)?  What is it you expect to do with that scenario?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,707)