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

Need someone to create custom calculation script PLEASE

New Here ,
Oct 20, 2025 Oct 20, 2025

I have the following fields:

"New Construction or Addition" (let's call it Field 1)

"Undefined_2" (let's call it Field 2)

 

When someone puts a whole number into Field 1 I need that muliplied by .60 and the result will show up in Field 2 as an amount with two decimal places.  However, if Field 2 is less than 600 then Field 2 needs to then say 600 with no decimal places.

 

I am very new to scripts so any help would be much appreciated.

 

Thank you!

TOPICS
General troubleshooting
84
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 ,
Oct 20, 2025 Oct 20, 2025

Try this as custom calculation script of field 2:

var f1 = this.getField("New Construction or Addition").value;

if (/^[1-9]\d*$/.test(f1)) {
 var num = Number(f1);
 var result = num * 0.60;
 if (result < 600) {
  event.value = 600;} 
 else {
  event.value = result.toFixed(2);}} 
else {
 event.value = "";}
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
New Here ,
Oct 21, 2025 Oct 21, 2025

Thanks, that worked!  However, I also have a line below that that needs to be the sum of this final value plus some others.  When I tell this sum line to add the sum of field 2 it always shows it as 600 even if the resulting number is higher than 600.  Any thoughts?

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
New Here ,
Oct 21, 2025 Oct 21, 2025

Actually the sum line I have below is acting differently than what I said.  If the amount in field 1 is 1004 then field 2 results in 602.40 which is correct.  But when I create a field below that takes the sum of field 2 it lists it as 601.80.  Any ideas why?

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 ,
Oct 21, 2025 Oct 21, 2025

Can you share file?

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
New Here ,
Oct 21, 2025 Oct 21, 2025

Here you go, its on the first page.

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 ,
Oct 21, 2025 Oct 21, 2025

You have issue with field calculation order, undefined_8 field should be under undefined_2 field.

To change field calculation order in old acrobat:
Select 'Prepare form' tool, click 'More' then 'Set field calculation order'.

In new Acrobat:
Select 'Prepare form' tool, click on the 3 dots (the ones where say 'fields') and select 'Set field calculation order'.

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
New Here ,
Oct 21, 2025 Oct 21, 2025

Thanks!  That fixed it.

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
New Here ,
Oct 21, 2025 Oct 21, 2025
LATEST
Actually the sum line I have below is acting differently than what I said. If the amount in field 1 is 1004 then field 2 results in 602.40 which is correct. But when I create a field below that takes the sum of field 2 it lists it as 601.80. Any ideas why?
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