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

Specific calculation

Community Beginner ,
Sep 22, 2023 Sep 22, 2023

Copy link to clipboard

Copied

Hi Guys,

Very new to Acrobat calculations and I are Ok with basic +-* and x. I are attempting to create a weighing document for mobile car & caravan weighing business.

In one table all weights over or under are displayed so the customer can where they are over weight or order weight.

Then I have created a table where only overweight numbers are displayed and if there are any numbers in this table, it requires attention. If the table is blank then nothing needs to be attended to.

 

How do I write a calculation that displays the amount from the over/under weight box (TVGVMTOTAL) only if it is over the maximum weight?

Eg: The maximum weight is 100kg and the weight is 101kg or more.

Is it something like TVGVMTOTAL>

Gee, I hope this makes sense...

Cheers Yt22

TOPICS
How to

Views

1.6K

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 ,
Sep 22, 2023 Sep 22, 2023

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 ,
Sep 23, 2023 Sep 23, 2023

Copy link to clipboard

Copied

Too technical for me I'm afraid.

Here is what I are trying to do.

If the GVM value is higher than the compliance plate value, I want it to display in the Overweight item box. Only numbers higher than the compliance plate are to show.

Also if it could be shown in red font that would be great.

Cheers Yt22.

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 ,
Sep 23, 2023 Sep 23, 2023

Copy link to clipboard

Copied

Help please_012634.jpg

Too technical for me I'm afraid.

Here is what I are trying to do.

If the GVM value is higher than the compliance plate value, I want it to display in the Overweight item box. Only numbers higher than the compliance plate are to show.

Also if it could be shown in red font that would be great. 

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 ,
Sep 23, 2023 Sep 23, 2023

Copy link to clipboard

Copied

I guess you mean it should show the difference, not the GVM value itself...

You can use this code as the custom calculation script of the third field to achieve it:

 

var gvm = Number(this.getField("TVMWGVM").valueAsString);
var compliance = Number(this.getField("TVCPGVM").valueAsString);
var diff = gvm-compliance;
if (diff<0) event.value = diff;
else event.value = "";

 

Under the field's Properties, in the Format tab select Number and set it to show negative values as red text and in parentheses to achieve the formatting you desire.

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 ,
Sep 24, 2023 Sep 24, 2023

Copy link to clipboard

Copied

Hi Mate,
Yes, it should show the difference. In the example I sent I would like the value to be shown in a new box I have created (called "GVMATT" not shown in the example sent). The amount would be 353.

var gvm = Number(this.getField("TVMWGVM").valueAsString); var compliance = Number(this.getField("TVCPGVM").valueAsString); var diff = gvm-compliance; if (diff<0) event.value = diff; else event.value = "";

I copied & pasted the above calculation into the custom calculation script and it didn't work.
What did I do wrong?

Thanks for your time. Yt22...

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 ,
Sep 24, 2023 Sep 24, 2023

Copy link to clipboard

Copied

Check the JS Console (Ctrl+J) for error messages, after you change the value of one of the fields.

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 ,
Sep 24, 2023 Sep 24, 2023

Copy link to clipboard

Copied

Had a look at the JS Console and didnt know what I was looking for.

I had another look at what you wrote and found that the ">" was "<" so the calculation was not showing up as it was under the compliance weight.

Thanks so much for helping me out as I was about to give up.

Cheers Yt22...

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 ,
Sep 28, 2023 Sep 28, 2023

Copy link to clipboard

Copied

Hey mate, still having issues. The overweight box calculates but it is wrong. If I wipe out the figure it calculates and press enter, it displays the correct amount.

IMG_20230928_235307.jpg

The JS Console displays this 

IMG_20230928_233511.jpgand I have no idea what that means.

Just wondering, my calculation for "GVMTOTAL" are  a simplified field notation (TVWHEEL1+TVWHEEL2+TVWHEEL3+TVWHEEL4), not a custom calculation as you sent me. Would this matter?

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 ,
Sep 28, 2023 Sep 28, 2023

Copy link to clipboard

Copied

IMG_20230928_235307.jpg

IMG_20230928_235327.jpg

 

 

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 ,
Sep 28, 2023 Sep 28, 2023

Copy link to clipboard

Copied

If I make a mistake in a post here and realise after posting here, how do I edit it, as I can't find a edit post button...

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 ,
Sep 28, 2023 Sep 28, 2023

Copy link to clipboard

Copied

Error means there is no field with such name.

Check your script and make sure you use correct field names.

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 ,
Sep 28, 2023 Sep 28, 2023

Copy link to clipboard

Copied

Ok, thanks, I will have a snoop around, but I am confused.

How come it displays an incorrect figure the first time, then it I delete that figure in the overweight box and press enter it displays the correct answer?
Cheers Yt22.

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 ,
Sep 28, 2023 Sep 28, 2023

Copy link to clipboard

Copied

Change the field calculation order. 

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 ,
Sep 28, 2023 Sep 28, 2023

Copy link to clipboard

Copied

Sorry mate,

I have never done anything like this before and I need to get this finished.

Is there anyone on this forum that can get this working for me, as it is beyond me and I feel like I will be wasting everyone's time if I continue.
Respectfully I don't know what you guys are talking about and I don't want to piss anyone off.
Yt22...

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 ,
Sep 28, 2023 Sep 28, 2023

Copy link to clipboard

Copied

You can share your file with us, so we can see what is actually going on.

To fix calculation order, select 'Prepare form' tool, then click on 'More', then click on 'Set field calculation order' make sure fields that calculate firsts are on top, so fields that should calculate last are at bottom.

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 ,
Sep 29, 2023 Sep 29, 2023

Copy link to clipboard

Copied

LATEST
Hi Nesa,

This file has got beaten me,

I fixed the GVM issue but others are still not working.

Can I send you a PM with the file?
Cheers Yt22.

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