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

Dropdown calculation

Community Beginner ,
Nov 25, 2022 Nov 25, 2022

C3706D85-16F8-410E-9D19-F28BFC7C2051.jpegexpand image

 how can i do this? 

TOPICS
Create PDFs , Edit and convert PDFs , JavaScript
2.4K
Translate
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
2 ACCEPTED SOLUTIONS
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 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 :

 

View solution in original post

Translate
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

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.

View solution in original post

Translate
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 25, 2022 Nov 25, 2022

Anyone help me please. I need this urgent 

Translate
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

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 :

 

Translate
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

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

Translate
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

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

Translate
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

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.

Translate
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

Thank you so much 

Translate
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

Hlw

Translate
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

Many many thanks. The script is working 

Translate
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
LATEST

You're welcome.

Translate
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