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

Dropdown calculation

Community Beginner ,
Nov 25, 2022 Nov 25, 2022

Copy link to clipboard

Copied

C3706D85-16F8-410E-9D19-F28BFC7C2051.jpeg

 how can i do this? 

TOPICS
Create PDFs , Edit and convert PDFs , JavaScript

Views

2.0K

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 2 Correct answers

Community Expert , Nov 26, 2022 Nov 26, 2022

You need to employ a script.

 

See example below:

 

var amount = Number(this.getField("AMOUNT1").value);
var schedule = this.getField("SCHEDULE1").valueAsString;

if (amount =="" || schedule =="") {

    event.value = "";

} else {

    if (schedule !=="") {

     if(schedule == "Weekly")   event.value = amount;

       else if(schedule == "Monthly") event.value = util.printf("%.2f", (amount / 12));

       else if(schedule == "YEARLY")  event.value = amount * 4;

  }
  
}

 

Just modify the fiel

...

Votes

Translate

Translate
Community Expert , Nov 26, 2022 Nov 26, 2022

Here you go:

https://drive.google.com/file/d/1v3bZ2kg4WBhgsgzGpwSbjOrPKK7KOhuh/view?usp=share_link 

You have very poorly field naming, so I changed some field names, so it's easier to calculate.

Script is in "MonthlyCharge12" field as custom calculation script, it will calculate all rows.

Votes

Translate

Translate
Community Beginner ,
Nov 25, 2022 Nov 25, 2022

Copy link to clipboard

Copied

Anyone help me please. I need this urgent 

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 26, 2022 Nov 26, 2022

Copy link to clipboard

Copied

You need to employ a script.

 

See example below:

 

var amount = Number(this.getField("AMOUNT1").value);
var schedule = this.getField("SCHEDULE1").valueAsString;

if (amount =="" || schedule =="") {

    event.value = "";

} else {

    if (schedule !=="") {

     if(schedule == "Weekly")   event.value = amount;

       else if(schedule == "Monthly") event.value = util.printf("%.2f", (amount / 12));

       else if(schedule == "YEARLY")  event.value = amount * 4;

  }
  
}

 

Just modify the field names when you declare the variables with what you have in your PDF form.

 

I just made up the names of the fields based on your screenshot to "SCHEDULE1" for the dropdown menu, and "AMOUNT1" for the dollar value field.

 

Here's a working file that you can evaluate :

 

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 26, 2022 Nov 26, 2022

Copy link to clipboard

Copied

I can't do the task can you please give me 1st/2nd row? 

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 26, 2022 Nov 26, 2022

Copy link to clipboard

Copied

Please do the 1st row me. The field is setup, you just give me one row and I will do the rest

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 26, 2022 Nov 26, 2022

Copy link to clipboard

Copied

Here you go:

https://drive.google.com/file/d/1v3bZ2kg4WBhgsgzGpwSbjOrPKK7KOhuh/view?usp=share_link 

You have very poorly field naming, so I changed some field names, so it's easier to calculate.

Script is in "MonthlyCharge12" field as custom calculation script, it will calculate all rows.

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 27, 2022 Nov 27, 2022

Copy link to clipboard

Copied

Thank you so much 

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 26, 2022 Nov 26, 2022

Copy link to clipboard

Copied

Hlw

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 27, 2022 Nov 27, 2022

Copy link to clipboard

Copied

Many many thanks. The script is working 

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 27, 2022 Nov 27, 2022

Copy link to clipboard

Copied

LATEST

You're welcome.

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