Copy link to clipboard
Copied
I have an acrobat order form with 104 products. People can buy an individual item or cases of that item. I've been able to calculate the product cost per item and per case.
My issue is that there are discount conditions based on the number of cases purchased:
I have a tally of all cases purchased called "Case Qty" (CQ), and I have a tally of the cost of all items purchased called "Total Cost" (TC). In a cell called "Discount Cost", I have a CCS that seems to be working, with a few exceptions: if there are exactly 8 cases ordered, no discount is applied to the cell. Also, sometimes if you meet the criteria for a discount then change the case value so that it doesn't meet the criteria, the discount value is still applied to the cell. Can anyone see what I'm doing wrong? Thanks so much for the help.
var CQ = this.getField("Case Qty").value;
var TC = this.getField("TOTAL COST").value;
if(( CQ > 7 ) && (CQ < 24 )) event.value = TC*0.90;
else if( CQ > 23 ) event.value = TC*0.80;
else if( CQ < 8) event.value = TC*0;
Copy link to clipboard
Copied
Try this, be sure to use it as a Calculation script:
var CQ = this.getField("Case Qty").value;
var TC = this.getField("TOTAL COST").value;
if( CQ < 8) event.value = TC*0;
else if(( CQ >= 8 ) && (CQ <= 23 )) event.value = TC*0.90;
else if( CQ > 23 ) event.value = TC*0.80;
Copy link to clipboard
Copied
Thanks for the quick response, JR.
Still having issues with the discount not showing up for exactly 8 cases purchased, also the discount being applied to the cell when conditions are initially met then changed so they are not.
Copy link to clipboard
Copied
Change the field calculation order.
Copy link to clipboard
Copied
Thanks Bernd.
Would you start with highest criteria value and end with lowest? >=24, >=8 && <=23, <8
Still having some issues with the discount cell. Attached is a video showing what happens when values are entered and changed. The column on the right is my invisible Case Qty tally.
Thanks again.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Works perfectly! Thank you for the help!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more