Page 1 of 1

Creating a condition to match two words from a list

PostPosted: Tue Jan 16, 2018 2:40 am
by Anjadekar
I would like to create a condition for files that have two words from a list. For example, consider this list.

Alaska
Arizona
California
Colorado

I would like to create a condition that would match a file that has two words from this list. So California and Alaska.pdf would match but the files California.pdf or Alaska and Mexico.pdf would not.

I tried to do this with the rule attached in the picture but it doesn't quite work. Could someone please point me in the right direction? Thanks!

Image

In case the image above doesn't work, it's here - https://ibb.co/d7btP6

Re: Creating a condition to match two words from a list

PostPosted: Tue Jan 16, 2018 10:47 am
by Mr_Noodle
The problem is that a file named "Alaska" for instance would also match that rule. I can't think of any way to do what you want short of enumerating every possible combination, which isn't usually practical. I think you'd have to write a script to check that list.

Re: Creating a condition to match two words from a list

PostPosted: Tue Jan 16, 2018 10:51 am
by Mr_Noodle
Actually, thinking about it, you could do a variation of your rule.

Instead of "contains", use "contains match". Create a custom attribute, say "•State". In each case, have it match each of the states. In the next group, add a condition like "Name does not contain match •State".

How this works is that the first instance of •State to match will be bound to that state. For instance, if the name has "California" first, then •State will have to match "California" for each usage after that. The above is a bit tricky to grasp but give it a try and post back if you have any problems.

Oh, and check your spelling on "Colorado".

Re: Creating a condition to match two words from a list

PostPosted: Mon May 14, 2018 10:06 am
by Anjadekar
Mr_Noodle wrote:Actually, thinking about it, you could do a variation of your rule.

Instead of "contains", use "contains match". Create a custom attribute, say "•State". In each case, have it match each of the states. In the next group, add a condition like "Name does not contain match •State".

How this works is that the first instance of •State to match will be bound to that state. For instance, if the name has "California" first, then •State will have to match "California" for each usage after that. The above is a bit tricky to grasp but give it a try and post back if you have any problems.

Oh, and check your spelling on "Colorado".


Apologies for resurrecting an old thread but I am revisiting my rules after a while and realised that I still haven't gotten around to implementing this as I didn't quite understand what you mean. Could you please explain it in more detail, preferable with screenshots/an example if that is not too much to ask? Thanks!

Re: Creating a condition to match two words from a list

PostPosted: Mon May 14, 2018 10:58 am
by Mr_Noodle
Actually, what I posted won't work as it would also match "California and Mexico". I think for something like this, you will need to use custom logic in a script.