5 Replies Latest reply on Jul 4, 2017 1:05 PM by philmodjunk

    Calculation If Statement 3 Results

    ZoocMan85

      If ( TypeBeerSelect = "Bottle" or "Can" or "Draft"; Brew_Settings::SalePriceBottle ; Brew_Settings::SalePriceCan ; Brew_Settings::SalePriceTap )

       

      That is my current calc, however filemaker only allows you to do 2 results. How do I make this work ?

        • 1. Re: Calculation If Statement 3 Results
          MaxEh

          You could try a Case  statement:

           

          Case (

          TypeBeerSelect = "Bottle"; Brew_Settings::SalePriceBottle;

          TypeBeerSelect = "Can"; Brew_Settings::SalePriceCan;

          TypeBeerSlect = "Draft"; Brew_Settings::SalePriceTap;

          "No Beer!")

           

          Read up in the help file. You could add other "cases" to extend the list.

          • 2. Re: Calculation If Statement 3 Results
            TomHays

            ZoocMan85 wrote:

             

            If ( TypeBeerSelect = "Bottle" or "Can" or "Draft"; Brew_Settings::SalePriceBottle ; Brew_Settings::SalePriceCan ; Brew_Settings::SalePriceTap )

             

            That is my current calc, however filemaker only allows you to do 2 results. How do I make this work ?

             

            You've got two problems.

             

            (1)

            TypeBeerSelect = "Bottle" or "Can" or "Draft"

            should be written as

            (TypeBeerSelect = "Bottle") or (TypeBeerSelect = "Can") or (TypeBeerSelect = "Draft")

             

             

            (2) It sounds like you want to have more than two options for your result.  A single If() statement only provides for two outcomes.  A Case() is just like an If() statement but it allows for more outcomes.

             

            Case(

            TypeBeerSelect = "Bottle"; Brew_Settings::SalePriceBottle;

            TypeBeerSelect = "Can"; Brew_Settings::SalePriceCan;

            TypeBeerSelect = "Draft"; Brew_Settings::SalePriceTap;

            ""

            )

             

            The last result in the Case() is the default choice if no matches were found.

             

            -Tom

            1 of 1 people found this helpful
            • 3. Re: Calculation If Statement 3 Results
              bigtom

              Case ( )

               

              Case(  TypeBeerSelect = "Bottle";  Brew_Settings::SalePriceBottle ; TypeBeerSelect = "Can";  Brew_Settings::SalePriceCan; TypeBeerSelect = "Draft";   Brew_Settings::SalePriceTap )

              1 of 1 people found this helpful
              • 5. Re: Calculation If Statement 3 Results
                philmodjunk

                You might also include the typeBeerSelect field as an additional match field and put each price in its own record. Then neither If nor Case would be needed.