8 Replies Latest reply on Jul 10, 2009 5:56 PM by LaRetta_1

    Need Some Help



      Need Some Help


      Hello All,



      Can this be done?




      I have a field name called approve with two option yes or no?   I have another field name call order status.



      When the user choose no in appove field, I want order status to say Deny.


      How can this be done?   

        • 1. Re: Need Some Help

          Yes.  For the 'order status' field, setup an auto-enter calculation, = Case ( Approve = "No", "Deny )

          • 2. Re: Need Some Help

            The auto-enter technique will work if both fields are in the same table and the "do not replace existing value..." check box is cleared.


            Alternatively, you can define a calculation field and place the same expression in it--that will update consistently even if the fields are not in the same table.

            • 3. Re: Need Some Help
                 Work Perfect.      Thanks to all:smileyvery-happy:
              • 4. Re: Need Some Help



                [quote]Yes.  For the 'order status' field, setup an auto-enter calculation, = Case ( Approve = "No", "Deny) [/quote]


                With only one option why use a case statement.


                What about


                If ( Approve = "No", "Deny;"")

                • 5. Re: Need Some Help
                     Why not?
                  • 6. Re: Need Some Help
                       Why include the ';""'?  Plus, I heard that Case was faster than If, but I'm not sure if that's true.
                    • 7. Re: Need Some Help

                      etripoli wrote:
                      Why include the ';""'? 


                      Including the empty string simply makes it obvious to the reader what result is returned. That's certainly my preference, but it IS a preference.


                      • 8. Re: Need Some Help

                        I read it as, why not use Case() instead of If() ... addressing R. Schaub here "With only one option why use a case statement" who provided an If() calculation instead.  There is no speed difference between the two whatsoever and they both short circuit (stop evaluating) when they hit the first true.  The only difference is that If() is limited to two choices and Case() has no limit.  So if you write an If() calculation and decide to add other criteria, you must change it to Case() but if you write a Case() calc and decide you only want two options, no change has to be made.


                        So I agree with John ... why NOT use Case() here?  And no, since vs. 7, it is no longer necessary for If() calculations to have a default result.  It, like Case() provides null as default if not specified.