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

Community Beginner ,
Nov 30, 2018

Copy link to clipboard

Copied

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.

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)) : "";

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

146

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

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

Community Beginner ,
Nov 30, 2018

Copy link to clipboard

Copied

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.

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)) : "";

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

147

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 30, 2018 0
Community Beginner ,
Nov 30, 2018

Copy link to clipboard

Copied

adobe help - Google Drive

is the link to the photos 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2018 0
Most Valuable Participant ,
Nov 30, 2018

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2018 1
Community Beginner ,
Nov 30, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2018 0
Most Valuable Participant ,
Nov 30, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2018 1
Community Beginner ,
Nov 30, 2018

Copy link to clipboard

Copied

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)) : "";

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2018 0
try67 LATEST
Most Valuable Participant ,
Nov 30, 2018

Copy link to clipboard

Copied

Well done!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2018 2
Most Valuable Participant ,
Nov 30, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2018 0
Community Beginner ,
Nov 30, 2018

Copy link to clipboard

Copied

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"

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2018 0
Community Beginner ,
Nov 30, 2018

Copy link to clipboard

Copied

not just the "what"**

excuse the typo! and thank you again for suggestions!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 30, 2018 0