SOLVED

Filtering Gallery based on SP list field and wildcard

Copper Contributor

Hi All,

 

Here is my issue. I have an SP list for recording hazards on our factory floor. Each item in the SP list has a unique number i.e

Hazard 1 

Hazard 2 

etc

 

Along side this we have a document library collecting PDFs and pictures. 

 

I have a gallery for the doc lib which I'd like to filter based on the SP list hazard number. The doc lib has files named by the hazard number and todays date i.e

 

Hazard 1_06_12_2019.pdf

Hazard 1_05_05_2019.pdf

 

I can filter this using one of the following formulas

 

LookUp(Apps,Name = Gallery4.Selected.Title)

Or Filter(Apps,StartsWith(Name,Gallery4.Selected.Title))

 

My problem is if I use the StartsWith command then when I get to Hazard 11 the gallery still shows 

documents for Hazard 1 and Hazard 11 and they both start with Hazard 1***

 

If I use the Lookup command it doesn't find the files as the Hazard files have the date at the end.

 

Is there a way to achieve what I'm after? Hope I've made sense, it sounded good in my head 🙂

 

Thanks

Gavin

2 Replies
best response confirmed by Gavin Squires (Copper Contributor)
Solution
You don't have any kind of Lookup columns on the SharePoint list to help keep these Item's together with a key pair? If you had a lookup column in the doc lib, that referenced the hazards, then you could look up the hazard name, then it would be much easier to just match there, then have a separate column for the date, or does everyone not want to put in metadata and just upload files based on name?

You could also use Flows to set metadata for you.


Anyway, to match those by name as is you could try the following. (Don't know if you would have delegation issues or not, but worth a test)

Filter(Apps,StartsWith(Name = Gallery4.Selected.Title & "_")

So what I'm doing here, assuming all filenames have an underscore after the hazard, is temporarily for the filter appending an underscore to the selected Hazard, this way when it goes to match, StartsWith Hazard 1_06_etc would match Hazard 1_ and not Hazard 11_ etc.

Don't have a test setup to test, but off top of my head that should technically work, just dont' know about delegation.

Hi @ChrisWebbTech , thanks for your reply. I hadn't thought about the lookup column. Sometimes it just takes someone else's point of view to change things. I've now added some meta data and have a linked column. It now works perfectly and no delegations issues.

 

Thanks for your help 🙂

 

Gav

1 best response

Accepted Solutions
best response confirmed by Gavin Squires (Copper Contributor)
Solution
You don't have any kind of Lookup columns on the SharePoint list to help keep these Item's together with a key pair? If you had a lookup column in the doc lib, that referenced the hazards, then you could look up the hazard name, then it would be much easier to just match there, then have a separate column for the date, or does everyone not want to put in metadata and just upload files based on name?

You could also use Flows to set metadata for you.


Anyway, to match those by name as is you could try the following. (Don't know if you would have delegation issues or not, but worth a test)

Filter(Apps,StartsWith(Name = Gallery4.Selected.Title & "_")

So what I'm doing here, assuming all filenames have an underscore after the hazard, is temporarily for the filter appending an underscore to the selected Hazard, this way when it goes to match, StartsWith Hazard 1_06_etc would match Hazard 1_ and not Hazard 11_ etc.

Don't have a test setup to test, but off top of my head that should technically work, just dont' know about delegation.

View solution in original post