April 25, 201411 yr 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
April 25, 201411 yr 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.
April 25, 201411 yr 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.
April 25, 201411 yr 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).
April 25, 201411 yr Author 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!
April 25, 201411 yr 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 ¶.
Create an account or sign in to comment