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

Form calculation problems

Explorer ,
Oct 05, 2020 Oct 05, 2020

Hi there,

 

Any help for this will be greatly appreciated.

 

I have to set up a PDF based invoice where calculations have to happen within the form. I set one up the other day for a client and it worked fine. Now they've asked me to set up another one with different calculations and it's not behaving as expected.

 

Basically, there is a Total Hours column multiplied by an Hourly Rate column which calculates in a Total Cost column. The calculation I have is: formhours[number]*formhourlyrate[number] running down each of the 20 rows of the total cost column. This yields a correct sum in the corresponding row within the Total Cost column. However while the calculation in the Totals down the bottom yields a total for Total Hours, it does not yield a total for Total Cost although the calculation methods are the same.

 

Then moving across the form there is a Client Contribution column that needs to be subtracted from the Total Cost column to give a figure in the final Balance Due column. This calculation is :formservicecost[number]-formcontribution[number]. Only when a figure (even 0) is put in the Client Contribution column, does the previous Total Cost column yield a total at the bottom. 

 

The Balance Due Total at the bottom uses the same calculation method as Total Hours but always seems a calculation behind in yielding a total. However the final Balance Outstanding figure (which I guess is the most important figure) updates correctly with every entry.

 

I've attached the PDF in its basic form and I'm hoping someone can let me know where I'm going wrong in the calculations so that all fields calculate immediately.

 

Thank you in advance.

 

Andrew

TOPICS
Create PDFs , PDF forms
1.0K
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
1 ACCEPTED SOLUTION
Community Expert ,
Oct 05, 2020 Oct 05, 2020

You need to check field calculation order:

Izrezak.PNGexpand image

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
LEGEND ,
Oct 05, 2020 Oct 05, 2020

Did you checked the fields 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
Community Expert ,
Oct 05, 2020 Oct 05, 2020

You need to check field calculation order:

Izrezak.PNGexpand image

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
Explorer ,
Oct 07, 2020 Oct 07, 2020

Thank you! I managed to get everything working correctly. Thank you both so much for your help.

 

Cheers, Andrew

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 ,
Sep 10, 2024 Sep 10, 2024

Hello, seeking help with a .pdf form calculation.   I am trying to program the form to look at a field and provide a calculation.  For some reason it is not doing.  Basically , I need the following  If "Field" = 1 then 100, If "Field" = 2 then 200, If "Field"= to 3 then 300, if "Field" = to 4 then 400, If "Field" = >5 then 500.00

 

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 ,
Sep 10, 2024 Sep 10, 2024
LATEST

You want to show result in second field?

As custom calculation script of field where you want to show result use this:

var f = Number(this.getField("Field Name").valueAsString);
if(f === 1)event.value = 100;
else if(f === 2)event.value = 200;
else if(f === 3)event.value = 300;
else if(f === 4)event.value = 400;
else if(f >= 5)event.value = 500;
else
event.value = "";

Just replace "Field Name" with the name of the first field.

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