4 Replies Latest reply on Mar 13, 2012 6:15 AM by philmodjunk

    Conditional Formatting conflict with Scripts?



      Conditional Formatting conflict with Scripts?


      I have the last version of FM Pro v10 and I appear to have run into either a bug or really strange behavior.  Hopefully someone can help me work around this problem.

      A user is asked to create a simplified representation of a complex concept using 10 separate Fields, each contiaining 1 or 2 words.  The available word choices for each Field are put into a Popup based on the previous Field's chosen word.  Meaning, the words avaialble for FIELD_5 are based on what was chosen for a word in FIELD_4, or sometimes a combo of Fields.  The context choices are defined in a Table and filtered using various Relationships.

      For example, the first four fields might look like this in two different examples:

      I  ; Love ; To Drink ; Water

      We ; Hate ; Driving ; Slow

      Because of the dependency on the previous Word choice, the user must set the Fields in order since that's the only way to get the conditional relationships.  To help with that, each time a user changes a Field a Trigger is used to launch a Script that resets all subsequent Fields from that point on since the values are likely invalid.  For example, if I changed Love to Hate (FIELD_3) FIELD_4 through FIELD_10 have their values wiped out using SetField and a value of "".

      To help the user understand the progression I use Conditional Formatting to change the color of the next empty Field when the previous Field is set.  The user can also skip Fields in some defined cases so the Conditional Formatting uses Calculations to determine if it should change color or not.

      OK... so all of this works beautifully except for one thing!

      When FIELD_1 is reset it's Trigger tells the Script to wipe out all values in all Fields starting with FIELD_2 and going through to FIELD_10.  The problem is that no FIELD_2 will not reset no matter what, yet it is instructed to clear out just like all the others (which do clear out).  Script problem?  No.  The script was running fine for weeks before I thought of adding Conditional Formatting.  It also still works fine in a similar context which has no Conditional Formatting in the Layout.  And if I remove Conditional Formatting in the problematic Layout FIELD_2 is propperly wiped clean.

      Long story short... Conditional Formatting is somehow preventing a single SetField Script step from performing it's function.




        • 1. Re: Conditional Formatting conflict with Scripts?

          I need to see that script because I have to know where the is the focus at its end.

          • 2. Re: Conditional Formatting conflict with Scripts?

            I agree with Raybaudi, we need to see that script. It's highly unlikely that a conditional format could interfere with a set field script step's function.

            To post a script to the forum:

            1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
            2. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
            3. If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
            4. If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
            • 3. Re: Conditional Formatting conflict with Scripts?

              Thanks for the replies.  Been too busy with stuff to get back here.

              I looked at my script and decided it was too complicated anyway.  So I rewrote and simplified it.  Whatever conflict was overriding the expected script result for that one field was obviously specific to the original script, because the problem is gone now that I've used an entirely diffrent method of clearing the fields.  Since the problem has gone away I think we can close this one.

              For the record, I also agree that Conditional Formatting itself was far down on my list of suspects.  All I can say is with Conditional Formatting not enabled everything worked fine, but not when it was enabled.  It must have set up some sort of condition that something else didn't like too much.



              • 4. Re: Conditional Formatting conflict with Scripts?

                The only way I can conceive of a conditional format expression interfering with the function of a script would be if it contained a let function that assigned a value to a $$Variable--which was in turn used in your script. Scripts cannot access the format assigned by a conditional format, only the value of the field so that's the only way a value can be modified by the condiitonal format that could possibly affect the execution of a script.