Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

There's probably some rookie mistake that I'm missing here...

My invoice layout contains a couple fields for entering discounts. The DiscountPercent Field is just a plain number field, while DiscountValue is a number field with a calculation (Auto-enter Calculation replaces existing value). The calculation is:


If( IsEmpty( DiscountPercent ) ; DiscountValue ; SubTotal * (DiscountPercent / 100 ) )

This basically says that if there in a number in the DiscountPercent field, fill DiscountValue with that percentage of the SubTotal. If there's no number in the percent field, use whatever number is sitting in the value field. The grand total then subtracts this from the sub total.

I want a script that, when the DiscountValue field is clicked, it first clears out the DiscountPercent field, so that the user can enter a fixed amount in the value field. But for some reason, the scripts refuse to enter the DiscountValue field. I've tried both Set Selection[header::DiscountValue] and Go To Field[header::DiscountValue], and neither will enter it. I have other fields that are set up basically identically to this field, and the script can enter them just fine. Also, if I just click on the field, I can enter it without problem (but I would like the script so that the Percent field can be cleared first)

I would greatly appreciate if someone could let me know what I'm doing wrong here. Thanks.

Posted

See if you can get the idea here:

http://edoshin.skeletonkey.com/2006/06/linked_fields.html#more

Since my take on it is that it hardly deserves to be scripted at all!

--sd

Posted (edited)

Thanks a lot for the help. I had to change their calculations a little, but it's working great now.

Since my take on it is that it hardly deserves to be scripted at all!

My thoughts exactly! But I never thought to do it this way. Thanks again!

Still, even though I'm going to be using this method, do you have any ideas why that script wouldn't be able to enter the field? Now I'm curious.

Edited by Guest
Posted

Still, even though I'm going to be using this method, do you have any ideas why that script wouldn't be able to enter the field? Now I'm curious.

Well I can't copy here ... what am I missing in my template attached below?

--sd

Quaterkoen.zip

Posted

"I've tried both Set Selection[header::DiscountValue] and Go To Field[header::DiscountValue]"

Why not Set Field? Are you on a layout based on "header"?

This topic is 5743 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.