Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted (edited)

I am trying to search for a simple text string within a List of text strings and return a boolean result if the search text string exists within the list.  From what I understand, I can use FilterValues to accomplish this.

FilterValues ( "mySearchString" ; $MY_LIST_OF_VALUES )

If 'mySearchString' exists within the variable list 'MY_LIST_OF_VALUES', it will return 'mySearchString'.  I should then be able to use the GetAsBoolean function to return TRUE if the value is there and FALSE if the value is not found, correct?

If not, what's the correct method to do this?

 

Edit: Well from the Function reference for GetAsBoolean, I guess not.  Although even when I say:

If ( FilterValues ( "mySearchString" ; $MY_LIST_OF_VALUES ) = "mySearchString" ; True )

It returns false...

Edit 2: Well I'm stupid.  Turns out the function I was using to Add and Remove values from a list was adding a trailing ¶ to the first value once multiple values had been added to the list.  The above function returned True during the first creation of the global value list and then failed each subsequent time.  Now I know why...  

Code ( "mySearchString" ) ≠ Code ( FilterValues ( "mySearchString" ; $MY_LIST_OF_VALUES) )

but

Code ( "mySearchString" ) = Code ( FilterValues ( "mySearchString" ; $MY_LIST_OF_VALUES ) )

:facepalm:

Edited by James Gill
Posted

I should then be able to use the GetAsBoolean function to return TRUE if the value is there and FALSE if the value is not found, correct?

​No, that is incorrect. GetAsBoolean ( string ) does not test for the existence of string (unlike many other languages). The correct test is =

not IsEmpty ( FilterValues ( "mySearchString" ; $MY_LIST_OF_VALUES ) )

 

Posted (edited)

Is there is benefit to using this approach as opposed to PatternCount ( )?

Edit: Nevermind. I just realized you are trying to match the entire value, not just part of the string/value.

Edited by Josh Ormond

This topic is 3532 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.