Skip to main content
victoriap31769655
Inspiring
November 30, 2018
Answered

calculation help - (Q1*$1)-(DISC1/100) and SUB is empty IF 0

Attached is a link to the photos of my invoice form. I have the following columns:

Q=QTY.

$=$

DISC1=DISCT.

SUB=SUBTOTAL

I would like the subtotal to accurately calculate from the corresponding row values. Essentially the calculation of (Q1*$1)-(DISC1/100) so that the discount column presents as 35% instead of .35 when I present it to clients.

Then, how do I code SUBTOTAL as empty when the corresponding rows are empty.

This topic is closed to new replies. Start a new post to keep the conversation going.
victoriap31769655
victoriap31769655Correct answer
Inspiring
November 30, 2018

You need a simple if-condition. See: https://acrobatusers.com/tutorials/conditional-execution


thank you! those articles in conjuction were perfect for my puzzle. I ended up with this:

event.value = (this.getField('Q1').value && this.getField('$1').value && this.getField('DISC1').value) ? ((this.getField('Q1').value*this.getField('$1').value)-(this.getField('DISC1').value/100)) : "";

9 replies

Legend
November 30, 2018

It is best not to ask "how to code" because it can be seen as just asking us to write your code for you. Most of us are more interested in giving you what you need to learn how to write your own.

Translate
victoriap31769655
Inspiring
November 30, 2018

I did take the articles that try67 sent to me, as per my request on "how to code" and I came up with a code that works perfectly

event.value = (this.getField('Q1').value && this.getField('$1').value && this.getField('DISC1').value) ? ((this.getField('Q1').value*this.getField('$1').value)-(this.getField('DISC1').value/100)) : "";

you've misinterpreted my intentions. I love finding the "why" behind the code, not just the "how"

Translate
victoriap31769655
Inspiring
November 30, 2018

not just the "what"**

excuse the typo! and thank you again for suggestions!

Translate
victoriap31769655
Inspiring
November 30, 2018

adobe help - Google Drive

is the link to the photos 

Translate
try67
Community Expert
Community Expert
November 30, 2018

This is a good starting point for this task: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

Translate
victoriap31769655
Inspiring
November 30, 2018

I found that article on my search before posting, but I need a custom calculation script in order to get the SUB=empty if Q,$,and DISC are empty

Translate