February 25, 200620 yr I would like to know how to write a script or calculation that will enter the tax amount depending on either of two radio buttons. i.e. I have two radio buttons - 'T0' and 'T1'. If T0 is selected then I want the tax amount to be 0, otherwise I want the result to be the net amount x 1.175. Thanks for the help Lyndon
February 25, 200620 yr I made the attach example up for someone else, but apparently not for the Forum, at least I couldn't find it. Anyway, it isn't exactly like you described, but should help you figure out what you want. Lee SalesRetail_Whole_Sale.fp7.zip
February 26, 200619 yr Answering the original question for future reference though, you could use either an if or a case statement to achieve what you want. Just pointing this out to you because these may in mamy cases be the basis for many of your calculations. The format would be: If(test , result if returns true, result if test returns false) Case( test, result if true, test, result if true, test, result if true, more tests, more results if true, default result if none return true ) So in this case for example it would be If(taxfield = "T0" , 0 , netamount * 1.175 ) God comma's put me off... ~Genx
February 26, 200619 yr Tax rates change, so you shouldn't hard-code the rate into a calculation. It should be kept in a global field, or in a preferences/settings file, and looked up or auto-entered with the creation of a new record. I would also calculate the TaxAmount separately - in case someone wants to figure how much tax they paid in total. The calc for this would be: Round ( Amount * TaxRate * ApplyTax , 2 ) where ApplyTax is a Number field with either 0 (exempt) or 1 (taxed). The final sum to pay is Amount + TaxAmount. Just to clarify, the TaxRate in this example would be 0.175, not 1.175.
February 26, 200619 yr I thought it was bad practice to keep values that will change in a global field? ~Genx
February 26, 200619 yr User-specific values - certainly. Solution-wide values, that only change occassionally - not necessarily.
February 26, 200619 yr I agree that hard coding is really not the way to go, however, I just gave Llyndonium what he/she asked for. You could simply enter the tax rate or use a VL and have one button with the simple calc comment has offered, or no button at all, and it solves the problem and gives a lot more flexibility.
Create an account or sign in to comment