5 Replies Latest reply on Jan 13, 2016 7:27 PM by macwombat

    Tax Rate Checkbox

    Ryusui

      Greetings,

       

      I would like to have a checkbox which I can use to have my database choose from either a retail or wholesale tax rate.  Basically, I want the tax rate to default to retail if the box is unchecked, and to change to wholesale if the box is checked.  I tried setting up a checkbox field and using a CASE statement in my tax rate field, but it's not working.  Here's what I have as a calculated value:

      Case ( Weddings::tax_wholesale = "Wholesale" ; "0.005" ; "0.0417" )

      However, all this does is use the wholesale tax rate if checked, and use nothing if unchecked.  Also, the tax field doesn't update in real time.  If I check or uncheck the field, and then move to a different record and back again, it will then have updated.  I want to be able to have the checkbox update the field while I'm live in the record.

       

      Thanks for your help!

        • 1. Re: Tax Rate Checkbox
          macwombat

          A few things you can check about your tax rate calculation:

          1.  Untick the option in the calculation window that says "Do not evaluate if all referenced fields are empty" (that will make sure the calculation evaluates for records that don't have the wholesale tax rate checked).

          2.  In storage options make it an unstored calc.

          3.  Take your tax rates (eg. 0.005) out of the inverted commas (eg. Weddings::tax_wholesale = "Wholesale" ; .005 ; .0417 )

          4.  Make sure your calculation result is set to "Number"

           

          Hope this helps.  Chris

          1 of 1 people found this helpful
          • 2. Re: Tax Rate Checkbox
            Ryusui

            Thank you so much for your response, Chris.

             

            I did as you suggested and now the tax field properly uses the appropriate tax amount, thanks!

             

            Also, I think I messed up a bit in my initial post.  After inputting your changes, everything works, and once I click out of the checkbox it does update the field (which I guess it probably did before, but I think I was always just clicking over to the next record, and never actually clicked OUT of the checkbox to see if the changes happened - I seem to always forget about validating).  Is there a way for the field to update as soon as I click on the checkbox without having to click out of the field to validate it?

            • 3. Re: Tax Rate Checkbox
              macwombat

              Clicking out of the field to save/validate is a standard FM behaviour.  It can be worked around by putting script triggers on a field to run a save when the field is modified.  If you wanted to do that for 1 field or a few it is not too difficult, but could become a bother if you have to do it with every field on your layouts.  Therefore it is helpful to get used to the way FM works and you'll soon remember that to commit a record you need to click out of the field.

              1 of 1 people found this helpful
              • 4. Re: Tax Rate Checkbox
                Ryusui

                Ok, thanks.  Yea, I pretty much knew that FM works like that, but once I made my database, it's very rare that I go back into the developer mode to make any changes.  So I forget things quite quickly.

                 

                Thanks again, Chris.  You've been an amazing help!

                • 5. Re: Tax Rate Checkbox
                  macwombat

                  Pleasure