June 3, 201015 yr Hello, In my database, there's a drop-down menu where the user can select various options--say, A, B, C, or D. I am trying to write a script that puts an X in a different edit field/checkbox IF the user selects B, C, or D (not A) in the drop-down. Every time I write the script, it puts an X in the box regardless of what I've chosen (even if it's A). My script is simple: If [Field name="B" or "C" or "D"] Set Field [Field name; "X"] End If Do I have to do something different when working with value lists? Is there a special function I should be using? Thank you!
June 3, 201015 yr Look into patternCount. PatternCount( string1; string2) counts how many times string2 occurs in string1 You probably want if patternCount( "BCD"; yourField )
June 3, 201015 yr Why not make the field an auto-enter calculation If ( Field name = "A"; "";"X" ) with the Do not replace existing value box unchecked so that when the dropdown field value is selected the X is entered automatically
June 3, 201015 yr I forgot to add - add a script trigger OnObjectModify - to the field to run the script
June 7, 201015 yr Author Thanks, everyone...I'd like to do what you suggest, efen, but even with the auto-enter calculation I can't get it to put the X in the box at the correct time. I'd like it to put the X in the "subscription" box whenever any item *except* "entry fee" is selected from the "payment description" pop-up menu. I think I'm confused about how the calculation and script interact... I attached the file, in case you have a minute to look at it. Thank you!!! contest.fp7.zip
June 10, 201015 yr Author Yes, thank you! Clearly I need to read more about FMP functions and practice my script-writing. Thanks for taking the time! Edited June 10, 201015 yr by Guest
Create an account or sign in to comment