• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
Nov 30, 2018 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.

TOPICS
Acrobat SDK and JavaScript

Views

359

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
community guidelines

correct answers 1 Correct answer

Community Beginner , Nov 30, 2018 Nov 30, 2018

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

Votes

Translate

Translate
Community Beginner ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

adobe help - Google Drive

is the link to the photos 

Votes

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
community guidelines
Community Expert ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

Votes

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
community guidelines
Community Beginner ,
Nov 30, 2018 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

Votes

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
community guidelines
Community Expert ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Beginner ,
Nov 30, 2018 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)) : "";

Votes

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
community guidelines
Community Expert ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

LATEST

Well done!

Votes

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
community guidelines
LEGEND ,
Nov 30, 2018 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.

Votes

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
community guidelines
Community Beginner ,
Nov 30, 2018 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"

Votes

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
community guidelines
Community Beginner ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

not just the "what"**

excuse the typo! and thank you again for suggestions!

Votes

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
community guidelines