Jump to content

Getting Script to run automatically


This topic is 2038 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 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.

post-112652-0-19966500-1419972737_thumb.

Link to post
Share on other sites
  • 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"?

Link to post
Share on other sites

 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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

This topic is 2038 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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.