7 Replies Latest reply on Aug 24, 2011 10:02 AM by philmodjunk

    If Yes Function



      If Yes Function


      I would like to assign an 'if' function to a specific field. A 'yes' or 'no' function based on a simple value list.
      If yes, i need another field to appear. If no, then nothing should show up. Any help would be greatly appreciated. 

        • 1. Re: If Yes Function

          Define a calculation field as:

          If ( YesNoField = "yes" ; FieldToAppear )

          This will expose the value in "FieldToAppear" if Yes is selected in YesNoField, but is empty otherwise.

          There are also several methods you can use to make the actual editable field appear/disappear but they take a more sophisticated approach. You'll need to respond back if that's something you need here.

          • 2. Re: If Yes Function

            I have defined the calculation field with the following: If ( Yes_No = "yes" ; Cure_Date) My field to select from is defined as Yes_No & the field I would like to appear is Cure_Date. 

            Unfortunately I am receiving the following error: "This action cannot be performed because this field is not modifiable." I can't seem to figure out what I'm doing wrong. 

            Any further help with allowing the field to appear/ dissapear will be fantastic. Thanks so much!

            • 3. Re: If Yes Function

              Calculation fields cannot be edited. If you try to change the value of your calculation field, you'll get this error message. Is that what you are doing when you get this message?

              • 4. Re: If Yes Function

                I created a dropdown field with two options - yes or no. I was trying to select yes as an answer when this error occured. 

                • 5. Re: If Yes Function

                  The dropdown field should be the field you named Yes_No. This calculation: If ( Yes_No = "yes" ; Cure_Date) should be a different field and it should not be named "cure_Date" either. YOu have three fields, yes_noe, Cure_Date and the above calculation field.

                  • 6. Re: If Yes Function

                    OK, got it! Thanks. I have created the 3 fields & am no longer receibing the error message. How would I actually show/hide the cure_date field that I have specified to appear? 

                    • 7. Re: If Yes Function

                      If you need the field to be editable and also want to hide/reveal the field, there's no need for the calculation field. That's a "read only" option where you'd replace the Cure Date field with the calculation field on your layout. It's the simplest approach here, but doesn't permit editing the cure_date field.

                      Heres one simple method:

                      Put a tab control with two tab panels on your layout. Select each panel in turn and use the name box in the Inspector's position tab to give each a name. I'll name them "Yes" and "No" in this example.

                      Put Cure_Date on the tab with objectname = "yes" (This is not the text in the tab label.)

                      Create this script:

                      Go To Object [YourTable::Yes_No]
                      Go To Next Field //this takes the focus away from the tab control.

                      Use an OnObjectModify script trigger on the Yes_No field to perform this script. Enter Layout setup... and select the OnRecordLoad trigger to perform the same script so this will update when you change records.

                      Test this to make sure you have everything working. Then, make the tab control invisible by giving it a fill color/pattern and pen color/pattern that either matches the layout color or is transparent.