lcouri Posted April 25, 2014 Posted April 25, 2014 I'm embarrassed to post this but trust me, I've exhausted searching the internet for strategies. Surely, with Filemaker Pro 12 there must be a way to create a function that looks to an existing text field and searches for a specific string?!? 'Products' would contain none or some or all of A B C D E , in a random order. I would like to create a calculation that searches for 'B' and returns a text expression (there is no "contains" function). I can't think it should be so difficult, I must be using the wrong terminology? ('B' is just a representation of a longer name, ie. "cookies" or "twinkies" could be the products ...) Thanks! Lance
comment Posted April 25, 2014 Posted April 25, 2014 function that looks to an existing text field and searches for a specific string Have a look at the PatternCount() function. The bigger question here is why do you have a field that contains multiple values. That's not a good strategy.
eos Posted April 25, 2014 Posted April 25, 2014 I would like to create a calculation that searches for 'B' and returns a text expression (there is no "contains" function). http://fmhelp.filemaker.com/fmphelp_12/en/html/func_ref3.33.77.html#1031282 Not sure what you mean by “returns a text expression“ – the result is the number of occurrences of the search string.
beverly Posted April 25, 2014 Posted April 25, 2014 Lance, is this a LIST (return delimited values)? if so, perhaps the list functions would help find a "match". You can return a "string" to a variable and/or field and/or dialog - however you make the match by script. Calculation could also return a string if there is a match. PatternCount() helps if you have unique enough values in the field (even multiples of the same phrases).
lcouri Posted April 25, 2014 Author Posted April 25, 2014 Have a look at the PatternCount() function. The bigger question here is why do you have a field that contains multiple values. That's not a good strategy. You're absolutely correct. This field is a result of another system export, so there's not much control over that. In fact, my whole issue is to extract a specific product (in this case) and thus render the 'multi-variable field' non-critical:) Thanks everyone, I'll give "PatternCount()" a try!
lcouri Posted April 25, 2014 Author Posted April 25, 2014 PERFECT. That works within my 'Case' argument perfectly:)
comment Posted April 25, 2014 Posted April 25, 2014 This field is a result of another system export, so there's not much control over that. In fact, my whole issue is to extract a specific product (in this case) and thus render the 'multi-variable field' non-critical:) Thanks everyone, I'll give "PatternCount()" a try! Beverly is correct that (with return-separated values) it is better to test for: not IsEmpty ( FilterValues ( "searchString" ; YourField ) ) This eliminates false positives such as when searching for "cat" in a field that contains "catalog". If your field is not return-separated, use the Substitute() function to replace the existing delimiter with ¶. 2
Recommended Posts
This topic is 3922 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 accountSign in
Already have an account? Sign in here.
Sign In Now