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

Weight Calculations

Community Beginner ,
Feb 18, 2024 Feb 18, 2024

Hello...I just would like to ask for your help regarding a weight calculation with verification and app.alert

Text1 - Text2 = Text3

if Text3 is between 28000kgs to 30000kgs the "Fee is applied"

if Text3  is more than 30000kgs its "Overweight"

SandLynx_0-1708318346870.png

 

 

 

TOPICS
Create PDFs , JavaScript , PDF forms
854
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 ,
Feb 18, 2024 Feb 18, 2024

For calculation in "Text3" field under 'Calculate' tab select 'Simplified Field notations' and enter: Text1-Text2.
For alert in the same field under 'Validate' tab select 'Run custom vaidation script' and enter this:
if(Number(this.getField("Text1").valueAsString) > 0 && Number(this.getField("Text2").valueAsString) > 0){
if(Number(event.value) > 28000 && Number(event.value) <= 30000)
app.alert("Fee is applied");
else if(Number(event.value) > 30000)
app.alert("Overweight");}

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 ,
Feb 27, 2024 Feb 27, 2024

Use this alert:

app.alert({
 cMsg: "Fee is applied",
 cTitle: "Overweight Calculations",
 nIcon: 1
});

This will still show 'Warning' message, to get rid of that you would have to create folder level script on your local machine (which would then only works on your PC).

tempsnip.png

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 ,
Feb 18, 2024 Feb 18, 2024

For calculation in "Text3" field under 'Calculate' tab select 'Simplified Field notations' and enter: Text1-Text2.
For alert in the same field under 'Validate' tab select 'Run custom vaidation script' and enter this:
if(Number(this.getField("Text1").valueAsString) > 0 && Number(this.getField("Text2").valueAsString) > 0){
if(Number(event.value) > 28000 && Number(event.value) <= 30000)
app.alert("Fee is applied");
else if(Number(event.value) > 30000)
app.alert("Overweight");}

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 ,
Feb 27, 2024 Feb 27, 2024

Hi Nesa...Thank you very much. This works. Just a few enhancement to the alert window. Would you be able to assist to change the following? Thank you. : )

 

SandLynx_0-1709095543868.png

 

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 ,
Feb 27, 2024 Feb 27, 2024

Use this alert:

app.alert({
 cMsg: "Fee is applied",
 cTitle: "Overweight Calculations",
 nIcon: 1
});

This will still show 'Warning' message, to get rid of that you would have to create folder level script on your local machine (which would then only works on your PC).

tempsnip.png

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 ,
Mar 02, 2024 Mar 02, 2024
LATEST

Hi Nesa..Thank you.

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