December 30, 201411 yr Newbies 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.
December 30, 201411 yr 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)?
December 30, 201411 yr Author Newbies 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"?
December 30, 201411 yr 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.
December 31, 201411 yr Author Newbies 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.
January 6, 201511 yr 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.
Create an account or sign in to comment