VAB Posted October 22, 2008 Share Posted October 22, 2008 (edited) I can't seem to figure out how to calculate if a value in one field is one of the values in a checkbox list. When I use Case (field1 = List ( field2 );"something happens"), "something happens" only when just one checkbox is checked. But I want this to be true when the same value is checked, no matter if there are others checked as well. Does this make sense? I hope someone can help me out... VAB Edited October 22, 2008 by Guest Link to comment Share on other sites More sharing options...
mr_vodka Posted October 22, 2008 Share Posted October 22, 2008 PatternCount ( ¶ & YourCheckboxField & ¶, ¶ & YourField & ¶ ) If it is checked it will return a value, most likely 1 if its unique. Link to comment Share on other sites More sharing options...
VAB Posted October 22, 2008 Author Share Posted October 22, 2008 I can't seem to figure out how to compare the value in one field to one of the values in a checkbox list. When I use Case (field1 = List ( field2 );"something happens"), "something happens" only when just one checkbox is checked. But I want this to be true when the same value is checked, no matter if there are others checked as well. Does this make sense? I hope someone can help me out... VAB Link to comment Share on other sites More sharing options...
mr_vodka Posted October 22, 2008 Share Posted October 22, 2008 Please do not double post. http://fmforums.com/forum/showtopic.php?tid/198847 Link to comment Share on other sites More sharing options...
Raybaudi Posted October 22, 2008 Share Posted October 22, 2008 Case( Length ( FilterValues ( Field1 ; Field2 ) ) ; "something happens" ) Link to comment Share on other sites More sharing options...
VAB Posted October 22, 2008 Author Share Posted October 22, 2008 i'm sorry. tried to delete the other post, didn't work. Link to comment Share on other sites More sharing options...
Ocean West Posted October 22, 2008 Share Posted October 22, 2008 Topics Merged... Link to comment Share on other sites More sharing options...
VAB Posted October 22, 2008 Author Share Posted October 22, 2008 thanks! Link to comment Share on other sites More sharing options...
VAB Posted October 22, 2008 Author Share Posted October 22, 2008 thank you!!! I don't understand why, but it totally works! Link to comment Share on other sites More sharing options...
VAB Posted October 22, 2008 Author Share Posted October 22, 2008 Sorry, both solutions seemed to work, but in end they didn't give me the results I wanted. So let me tell a little bit more about what I want: I use the calculation for a "replace field contents" behind a button. Field1 = 1,2,3... or 14 Field2 (checkbox set) = 1,2,3... and/or 14 Field3 = empty or "x" button1: Case1(When field1 = one of selected in field2 ; field3 = "x") button2: Case2(When field1 = one of selected in field2 ; field3 = "") Solution with length() doesn't works in case2. Solution with patterncount() doesn't work because it counts the "1" in "11", "12", "13" etc. as well. Can you help me? Link to comment Share on other sites More sharing options...
mr_vodka Posted October 22, 2008 Share Posted October 22, 2008 First why are you using Replace Field Contents? Second why do you have two buttons? It seems as if you only really need 1. The PatternCount should work but you can use FilterValues as well. I keep forgetting about that new function. All you really need is one button with a SetField. Set Field [ Field3; FilterValues ( Field2 ; Field1 )] Link to comment Share on other sites More sharing options...
Fitch Posted October 22, 2008 Share Posted October 22, 2008 I'm guessing PatternCount failed because you didn't construct the formula with the pilcrows (carriage return characters) as John specified in his original post. Link to comment Share on other sites More sharing options...
VAB Posted October 22, 2008 Author Share Posted October 22, 2008 that's it! thank you. Link to comment Share on other sites More sharing options...
VAB Posted October 22, 2008 Author Share Posted October 22, 2008 My field3 is a selection box too, to select my records in my database. I use two buttons, because I want to extend my previous selection. Anyway, it works now... thank you very much! Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 5803 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