11 Replies Latest reply on Jan 27, 2010 10:59 AM by LaRetta_1

# Checkbox Calculated Value

### Title

Checkbox Calculated Value

### Post

Good Morning everyone!

I am trying to make a checkbox on an invoice that when checked, calculates the 6.25% sales tax for MA.

I have the calculation for the tax all set it is as follows:

(Subtotal - Discount_Total) - (Subtotal - Discount_Total) * .625

The only problem is, I need a condition that makes it so that this calculation is only performed when the box for the "Taxable" field is checked.

I tried adding a couple of things before it, but the syntax wasn't correct.

Thanks!

• ###### 1. Re: Checkbox Calculated Value

Assuming your checkbox field is called Taxable, Try:

(Subtotal - Discount_Total) * .0625 * If ( Taxable = "Taxable" ; 1 ; 0 )

• ###### 2. Re: Checkbox Calculated Value
This didn't work, it still calculates tax when the discount changes. It also does not make the tax charge disappear when unchecked...
• ###### 3. Re: Checkbox Calculated Value

What is the formula you are using now?

• ###### 4. Re: Checkbox Calculated Value

(Subtotal - Discount_Total) - (Subtotal - Discount_Total) * .0625 * If ( Taxable = "Taxable" ; 1 ; 0 )

My Tax field is a Indexed Number field and my checkbox "Taxable" is an Indexed Text field.

• ###### 5. Re: Checkbox Calculated Value

(Subtotal - Discount_Total) * .0625 * If ( Taxable = "Taxable" ; 1 ; 0 )

^^ that's the formula I'm using, sorry I mistyped it the first time

• ###### 6. Re: Checkbox Calculated Value

That's not quite the same formula.  I think you added some extras.

Shouldn't the sales tax = (Subtotal - Discount_total) * .0625 * If (Taxable = "Taxable"; 1; 0 )    ?

and it should be a calculated field.

OK… I saw your edit. But make it an unstored calculated field not a number field with auto-entered calculation.

• ###### 7. Re: Checkbox Calculated Value

I would be inclined to write it like this:

If ( Taxable = "Taxable" and Subtotal ; (Subtotal - Discount_Total) * .0625 ; 0  )

And the reason I added the test to see if there is a value in Subtotal is so it won't throw you a minus value if there is a discount listed (possibly by error) but there is no subtotal.

... it's just another approach - I find it easier to write the test first, then list the desired result then list the default result if test isn't met.  And the 0 isn't required as long as > vs. 6.  I included it because sometimes it's nice to see the 0 in fields.  Also, it can be a number field with auto-enter REPLACE on it and doesn't have to be a calculation as long as both Subtotal and Discount_Total calculations aren't unstored.

• ###### 8. Re: Checkbox Calculated Value

Keep in mind tax rates change. The rate should be a lookup. That way if the rate DOES change the entire history of your DB is not overwritten.

RW

• ###### 9. Re: Checkbox Calculated Value
Good catch, Rick!!  I was looking only at the calculation construct!!
• ###### 10. Re: Checkbox Calculated Value