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
Copy link to clipboard
Copied
It's pretty vague, but these tutorials might help you get started:
https://acrobatusers.com/tutorials/conditional-execution
https://acrobatusers.com/tutorials/change_another_field
https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations
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.
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.
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.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Check the JS Console (Ctrl+J) for error messages, after you change the value of one of the fields.
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...
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.
The JS Console displays this
and 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?
Copy link to clipboard
Copied
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...
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.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Change the field calculation order.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied