4 Replies Latest reply on Jul 14, 2015 10:45 PM by AmberJeffery

    first script step not working

    AmberJeffery

      Title

      first script step not working

      Post

      Hello,

      New to filemaker and building data bases so really appreciate your help.

      I am having an issue with a script step not working, I am trying to make sure that two specific fields are not blank before printing.

      My script looks like this (quite simple script)

      If[Table::fieldname1=""]

      Go to field[table::fieldname1]

      Show custom dialog [what ever I wrote]

      Exit script

      End If

      If[table::fieldname2=""]

      Go to field[Table::fieldname2]

      Show custom dialog[what ever I wrote]

      Exit script

      Else

      freeze window

      Go to Layout [table::layout name]

      Print

      Go to [original layout]

      Exit script

      End IF

      Now , this is working for the second "IF" for field name 2, but not working on Filed name 1? I am getting the custom dialog when the second field is empty but it is allowing the first field to remain empty?

      What am I missing?

       

       

       

        • 1. Re: first script step not working
          thurmes

          To start, a better way to write the If statement is 

          If [IsEmpty ( Table::fieldname1 ) ]

          From what I've been able to tell, different types of fields handle your Table::fieldname1="" statement differently. For instance, in a FM file that is populated and has a variety of types of fields, do a Find with "" as the data to find; it will work fine in a text field, but you'll get an error message in a timestamp or date field. The IsEmpty function will work correctly with any type of field.

          • 2. Re: first script step not working
            AmberJeffery

            Hi William,

            Thank you for your reply.

            I changed the If to your suggested way of If[IsEmpty (thank you for the tip smiley)

            and the first field is still being overlooked. Like I said it is picking up field 2. I have checked each field and have the same settings (text) for both fields. I feel like it is going to be a simple box that needs ticking or something but I can't seem to find the box?

            • 3. Re: first script step not working
              philmodjunk

              Either the reference is to the wrong field (either in your script or on your layout) or the field only looks like it is empty. It might have a space, return or other nonvisible character in it. Click or tab into the field and try double clicking the contents to see if anything invisible highlights. Double check your Table::Fieldnam1 reference and make sure that the "table" part of this refers to the same table occurrence name as the field object on your layout where you are checking to see if this field is empty.

              • 4. Re: first script step not working
                AmberJeffery

                Thank you Phil, it seemed to have a non visible character as you suggested, I cleared the field again and now it is working.

                Many thanks smiley

                 

                I'm such a  rookie frown