Newbies cameroncaley Posted December 30, 2014 Newbies Posted December 30, 2014 So, I've been tasked with getting our FileMaker 10 working more the way we want it for 2015. I've already managed to get the layout and calculation issues fixed and working. Now I'm working on some scripting which is an area I've alwasy struggled with. Here is what I need to do. When we write up orders, some customers are tax exempt. I have created a field where I can input an "X" to label as Exempt, but I need to be able to remove the tax from the calculation for just that particular order. Here is a screen shot of the area on the layout I am talking about. Here is the script as I have it set up:  If [Workorder::Tax Exempt = "X"]    Insert Text [select; Workorder::Tax; "Exempt'] End If  My question is two part, can the script be set to run automatically upon putting an "X" in the Tax Exempt Box? And can it be set so that if I add more items to the order and it recalculates, that is doesn't put the tax back in?  This is a common mistake in our business of someone marking an order as Exempt, but adding more items to it and forgetting to take the tax back off.
comment Posted December 30, 2014 Posted December 30, 2014 Why does this need to be scripted? Why not simply calculate the tax (or not), based on the Exempt field's contents (which ideally would be either 1 or empty)?
Newbies cameroncaley Posted December 30, 2014 Author Newbies Posted December 30, 2014 Ok, Maybe I overestimated my abilities when I said "Intermediate" skill level, because I can't figure out how to put that into the calculation. Right now the "Tax" field is set to calculate "Subtotal * .07" What do I need to add in there so that it will not calculate the tax if the "Tax Exempt" field is marked with an "X"?
comment Posted December 30, 2014 Posted December 30, 2014 Right now the "Tax" field is set to calculate "Subtotal * .07" What do I need to add in there so that it will not calculate the tax if the "Tax Exempt" field is marked with an "X"? Try = Case ( IsEmpty ( Tax Exempt ) ; Subtotal * .07 ) Or, if you accept my suggestion to make Tax Exempt a Number field, using a value of 1 for True: Case ( not Tax Exempt ; Subtotal * .07 ) Even better would be to use = Case ( not Tax Exempt ; Subtotal * TaxRate ) and auto-enter the current tax rate into the TaxRate field. Without this, any change in tax rate will modify your existing records, which could be disastrous.
Newbies cameroncaley Posted December 31, 2014 Author Newbies Posted December 31, 2014 Thank you. That worked perfectly. I don't know why I didn't think about using the case function in the calculation. Too close to the problem, I guess.
mikedr Posted January 6, 2015 Posted January 6, 2015 Although your question has definitely been answered correctly, if you do need in the future to run scripts triggered on field changes/saves, look at the script triggers -- FM is quite powerful in this respect.
Recommended Posts
This topic is 3609 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