2 Replies Latest reply on Feb 14, 2011 6:42 AM by WilliamBartels

    Proper syntax for a comples expression

    WilliamBartels

      Summary

      Proper syntax for a comples expression

      Product

      FileMaker Pro

      Version

      11v02

      Operating system version

      Windows 7

      Description of the issue

      I am trying to write a fairly complex calculation, but I can not get the syntax correct.  I have reviewed the Help until I could probably quote it in my sleep.
      Here is the query

      If  (BILL > "1800" & DIANE > "1800"
            READ = "X"
      ELSE IF (BILL > "1800"
            READ = "B"
      ELSE IF (DIANE > "1800
            READ = "D"
      ELSE
            READ = " "
      END IF

      I HAVE TRIED NUMEROUS VERSIONS OF THIS EXPRESSION, BUT I CAN'T GET FileMaker Pro to accept it.

      Expected result

      IF THE 4 CHARACTER TEXT FIELD "BILL" IS GREATER THAN "1800"
      AND THE 4 CHARACTER TEXT FIELD "DIANE" IS GREATER THAN "1800"
      THEN THE 1 CHARACTER TEXT FIELD "READ" IS SET TO "X"
      ELSE IF "BILL" IS GREATER THAN "1800" THEN "READ" IS SET TO "B"
      ELSE IF "DIANE IS GREATER THAN "1800" THEN "READ" IS SET TO "D"
      ELSE "READ" IS SET TO SPACE

      TRUTH TABLE

                     BILL > "1800"  BILL < "1800

      DIANE > 1800           "X"      "D"

      DIANE < 1800           "B"      " "

      Actual result

      Errors from FileMaker Pro

      Please help me.  I can not purchase FilemakerPro until I am confident I can get the results I want.

      Exact text of any error message(s) that appear

      function does not exist

      not enough parameters for function

      function "ELSE IF" not found

      depending on where the program sees an error.

        • 1. Re: Proper syntax for a comples expression
          davidhead

          Hello William

          To do what you want in a calculation, you would use a Case statement which performs progressive tests.

          Something like this:

          Case ( Bill > 1800 and Dianne > 1800; "X"; Bill > 1800; "B"; Dianne > 1800; "D"; " " )

          The syntax of a Case statement like this is:

          Case ( Test1; Result1; Test2; Result2; Test3; Result3; DefaultResult )

          The Case statement short-circuits (stops processing) when any test returns true.

          This is not really that complex for FileMaker Pro to handle. You just need the correct function and syntax.

          Please let me know if you need further help or can't get it working.

          TS_Oz, FileMaker Inc.

          • 2. Re: Proper syntax for a comples expression
            WilliamBartels

            Thank you for the help. It works once I have corrected my wife's name from Dianne to Diane.