steigrafx Posted February 7, 2012 Posted February 7, 2012 I have a calculated field that tests for the presence of the word "Guard" in a text field. If present, the word "SEALED" is inserted into that calculated field. And that works...but, if the word Guard is not present, the calculated field shows a question mark instead of being empty. Here's the calc I'm using (result text, do not evaluate..., do not store...): If ( PatternCount ( Electronic Recording::Caption: ; "Guard" ) ; "SEALED" ; Electronic Recording::SEALEDtranscript ) Thanks, Kevin
doughemi Posted February 7, 2012 Posted February 7, 2012 What is in the field Electronic Recording::SEALEDtranscript ? If you just want the calc field to be blank, couldn't you replace that with just ""?
steigrafx Posted February 7, 2012 Author Posted February 7, 2012 I described that poorly, and have edited my original post. The "Sealed" field is calculated. I want the word "SEALED" to appear in the "Sealed" field if the "Caption" field contains the text "guard". Thanks, Kevin
Ron Cates Posted February 7, 2012 Posted February 7, 2012 What do you want in the Sealed field if the caption field does not contain Guard? If ( PatternCount ( Electronic Recording::Caption: ; "Guard" ) ; "SEALED" ; Electronic Recording::SEALEDtranscript ) This calculation says if the Electronic Recording::Caption field contains "Guard" then insert "SEALED" if not insert the contents of Electronic Recording::SEALEDtranscript Does the test for "Guard" work? Is "SEALED" being entered correctly and if the Recording::Caption does not contain "Guard", is that when the question mark appears? If so then it is coming from Electronic Recording::SEALEDtranscript
Ron Cates Posted February 7, 2012 Posted February 7, 2012 Not sure if you copied and pasted directly from your calc field but there does appear to be a stray colon int there after Electronic Recording::Caption If ( PatternCount ( Electronic Recording::Caption: ; "Guard" ) ; "SEALED" ; Electronic Recording::SEALEDtranscript ) That could cause problems
Keith LaMarre Posted February 7, 2012 Posted February 7, 2012 I've done a simple test and was able to recreate the "?" when the result of the calculation is NOT set to text. Are you certain that you set it to a text result? Enclosed example. test.fp7.zip
steigrafx Posted February 7, 2012 Author Posted February 7, 2012 Thanks, Ron and Keith. Yes, Ron, there actually is a colon in the field name. The calc works fine when the word "guard" is found. When nothing is found, I want the field to remain empty. Keith, the calculation is definitely set to Text. Thank you both for your time. Kevin
comment Posted February 7, 2012 Posted February 7, 2012 (edited) When nothing is found, I want the field to remain empty. Then make the calculation = If ( PatternCount ( Electronic Recording::Caption: ; "Guard" ) ; "SEALED" ) --- BTW, is it correct to assume that SEALEDtranscript is the name of the calculation field in question? Edited February 7, 2012 by comment
steigrafx Posted February 7, 2012 Author Posted February 7, 2012 Thanks again, comment. That works perfectly, which once again proves that "less is more". And yes, SEALEDtranscript is the calc field. Thank you all for your time and help. Kevin
Ron Cates Posted February 7, 2012 Posted February 7, 2012 And yes, SEALEDtranscript is the calc field. I believe the way you had it originally is called recursion since you are asking the calc field to call on it's self if the other field does not contain "Guard". But by calling on it's self you are asking it to run the calc again. And again, and again, and so on because it is impossible to produce a result. Like endless Russion dolls.
steigrafx Posted February 7, 2012 Author Posted February 7, 2012 So you're saying it was in some sort of infinite loop? That's not good! Have a great day, Kevin
comment Posted February 7, 2012 Posted February 7, 2012 I believe the way you had it originally is called recursion I believe it's called circular reference. Or infinite loop.
comment Posted February 7, 2012 Posted February 7, 2012 So you're saying it was in some sort of infinite loop? That's not good! LOL, I was just posting the above. No, it's not good. Though in most cases Filemaker's built-in protection kicks in after a while and saves you from crashing.
Ron Cates Posted February 8, 2012 Posted February 8, 2012 I stand correected. Circular reference, thanks comment :)
Recommended Posts
This topic is 4741 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