7 Replies Latest reply on Nov 2, 2012 6:34 PM by Stephen Huston

    calculations

    spundir

      Hi

      I am very new to filemaker and dont know much about scripting and calculation.

      I am trying to create two fields where :

       

      If one field (A) is filled then the user cannot leave the second field (B which is a date field) empty but

      If the field (A) is empty then the field (B) also stays empty.

       

      Can someone tell me how i will go about achieving this?

       

      Many thanks in advance

        • 1. Re: calculations
          jbante

          Do these two things to fieldB under the field options in Manage Database:

          1. In the Auto-Enter tab, select "Calculated value", and specify the calculation: "If ( IsEmpty ( fieldA ) ; "" /* Null */ ; /* Else */ Self )". Back in the field options uncheck the "Do not replace existing value of field (if any)" checkbox. This will clear any value in fieldB if fieldA is empty.
          2. In the Validation tab, select "Validated by calculation", and use this calculation: "IsEmpty ( fieldA ) or ( not IsEmpty ( A ) and not IsEmpty ( Self ) )". This will make it a validation error for fieldA to be filled and fieldB to be empty. You should probably specify a custom message for validation failure to clarify the problem for users when they encounter it.
          1 of 1 people found this helpful
          • 2. Re: calculations
            spundir

            the 2nd solution is not working. I used this code

             

            "IsEmpty ( fieldA ) or ( not IsEmpty ( A ) and not IsEmpty ( Self ) )"

             

            and I followed the instructions

             

            on the data entry when i commit it does nothing even if field A is filled

            • 3. Re: calculations
              spundir

              and thanks for the reply i can use any and all help in learning this software

              • 4. Re: calculations
                comment

                Try it this way?

                1 of 1 people found this helpful
                • 5. Re: calculations
                  jbante

                  Michael's validation calculation is simpler than mine, but the different calculation doesn't get to the heart of the issue you're finding. When you're setting the validation calculation, the calculation dialog has a checkbox at the bottom labeled "Validate only if field has been modified." When this is on, FileMaker wont try to validate fieldB unless you enter and try to exit the field. You need to un-check this, by the sounds of it.

                  • 6. Re: calculations
                    spundir

                    thanks Michael and jbante both the solutions worked very well it cuts down a ton of script i had put in all sort of places.

                     

                    I think I need to learn more about scripting. Coming from a Non IT background it all seems like greek to me. Is there any book and resources that you guys can recommend which may help.

                     

                    Thanks a lot

                    SP

                    • 7. Re: calculations
                      Stephen Huston

                      THE must-have book for understanding script step options and calculation deciphering:

                      • FileMaker 12 Developer Reference, Que Publishing, August 2012.
                      • ISBN-10: 0-7898-4847-9
                      • ISBN-13: 978-0-7897-4847-8

                      With much thanks to the authors: Bob Bowers, Dawn Heady, Steve Lane, and Scott Love.