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

Round up

Explorer ,
Jun 28, 2023 Jun 28, 2023

Currently I am using the simplified field notation to get my calculation. It is currently FieldA / FieldB. The number that is displayed is always a whole number since I have it formatted for 0 decimals. I want it to always visually show a whole number, but I want it to round up. If the number is 24.01 I want it to display 25. Currently it will display 24, and when I select the field I would see the 24.01. I want to see 25, and when I select the field see 24.01. Is this possible?

TOPICS
Create PDFs , How to , JavaScript , PDF , PDF forms
215
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 ,
Jun 29, 2023 Jun 29, 2023
LATEST

This is possible, but not with the simplified field notation. You would have to use a custom calculation script for this to work. 

 

event.value = Math.ceil(this.getField("FieldA").value / this.getField("FieldB").value);

This does not contain any error checking (e.g. FieldB could be zero, or eiher field could be a non-numeric value), but as long as you have "good" values, it will produce the correct results. 

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