Llyndonium Posted February 25, 2006 Posted February 25, 2006 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
aldipalo Posted February 25, 2006 Posted February 25, 2006 Here you go. Quick and dirty. You need to make it yours. Tests2.zip
Lee Smith Posted February 25, 2006 Posted February 25, 2006 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
Genx Posted February 26, 2006 Posted February 26, 2006 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
comment Posted February 26, 2006 Posted February 26, 2006 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.
Genx Posted February 26, 2006 Posted February 26, 2006 I thought it was bad practice to keep values that will change in a global field? ~Genx
comment Posted February 26, 2006 Posted February 26, 2006 User-specific values - certainly. Solution-wide values, that only change occassionally - not necessarily.
aldipalo Posted February 26, 2006 Posted February 26, 2006 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.
Recommended Posts
This topic is 6878 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now