Jump to content

Find multiple words in Value List


MikeKD

This topic is 2242 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi Folks,

 I hope you're all well.

I'm trying to use a Find step in a script, to find multiple words from a Global field checkbox in a field in the same table.

It works fine when just one word is selected, but fails when two or more are. I've tried different operators, but = and == don't work either.

Is it possible to get this kind of thing to work, or is it only do-able in related tables?

-------------------------

hmmm, having asked the question, I suppose I could separate the list into it's different words, give each a variable and Find for each variable. There are only three possible words so a max of three variables to set. Can't remember the text function off the top of my head, but pretty sure it's possible. Is there a sleeker way?

Best wishes!

Mike

Edited by MikeKD
typo
Link to comment
Share on other sites

You shouldn't have to do anything special to find multiple words. Have you tried it with no operators? It could be an issue with your script, can you post it? And could you give an example of the actual data?

Link to comment
Share on other sites

Basically you are declaring: you tried something and it didn't work.

What exactly does your script look like? Since you have return-separated values (from a checkbox field) you are going to have to create multi-step script.

Link to comment
Share on other sites

Thanks for the quick replies. I've attached the script below.

Each record has a Term field which is set to either Autumn, Spring or Summer.

I've set a global checklist to select any one, two or three of them.

It looks like it's searching for a field with both / all three words when more than one is selected in the global.

Hope that helps clarify a little!

ScriptImage.bmp

Link to comment
Share on other sites

I've now split the one variable into three; one for each word using the middle words function.

Is there are way to Find OR in Specify Find Requests - there seems to be no option other than AND; and no way of bracketing Find Requests.

Apologies for the questions; I've always had to use trial and error with Edit Find Requests before, and at the moment, it's mainly error despite going through the books & searching the forum..

Cheers!

Mike

Link to comment
Share on other sites

To perform OR logic, you must separate the requests.

For compound finds such as this, I prefer to script them without using the Restore feature. It gives me much more granular control, and keeps the find criteria more accessible when troubleshooting/rereading the script.

Enter Find Mode []
Set Field [template::year[]; 2018]
Set Field [template::InParentDiary; 1]
Perform Find []
Set Field [template::season[]; "spring"]
New Record/Request
Set Field [template::season[]; "summer"]
Constrain Found Set []

The New Record/Request step performs the OR function; the Constrain Found Set step pulls those criteria from the 2018 found set.
 

Use a calculation using the FilterList command to replace the literal seasons shown with checkbox items.

 

Edited by doughemi
Link to comment
Share on other sites

Doug, there is a very important omission in your script. After the first Perform Find, you need to re-enter Find Mode.

Otherwise; you're changing data in the current record.

And you probably want to add some error trapping.

Also: not sure what's up with your square brackets in the set field statements. I removed them here.
 

Enter Find Mode [] 
Set Field [template::year ; 2018]
Set Field [template::InParentDiary; 1] 
Set Error Capture [ On ] 
Perform Find [] 
If [ get( lastError) = 0 ] 
Enter Find Mode [] 
Set Field [template::season ; "spring"] 
New Record/Request 
Set Field [template::season ; "summer"] 
Constrain Found Set [] 
End If

 

Edited by BruceR
Link to comment
Share on other sites

Thanks guys!

I'll try to have a go at it today and see how it works - I think it's the New Record / Request step I've not used in that way before that I'll have to research a bit first..

Best wishes,

Mike

Link to comment
Share on other sites

This topic is 2242 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.