Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Getting Started, Learning, Etc.

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 11th, 2015, 07:56 AM
dreimer dreimer is offline
Senior Contributor
 
Join Date: Oct 2010
Location: Shakopee, MN
Posts: 465
Default Rounding Up

I have some jobs that have differing quantities ordered. I can fit 1500 per box. I am trying to create a rule to determine how many cartons are needed for each order. So then my labels will say for example 1 of 1 or 1 of 2, etc.

I used this rule but am not sure how to have no decimal places and round to the nearest whole number.

Code:
return Round((Field("Total Qty")/1500),0)
So for example one record will have 500 for the quantity but the rule returns .3 and will in turn return 0 but I want it to return 1. For order for 1000 it will return 1 since it is .6 and rounds up.

Question: Is there syntax to round up for any fraction of a whole number?

TIA
__________________
Don Reimer - JavaScript Novice

MAC OS 10.12.5 Acrobat XI 11.0.0 FP Creator 10.0.16
Windows 7 Acrobat X 10.1.4 FP Creator 9.3.9

Last edited by dreimer; March 11th, 2015 at 07:59 AM..
Reply With Quote
  #2  
Old March 11th, 2015, 08:02 AM
David Miller David Miller is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Wallingford, CT
Posts: 263
Default Re: Rounding Up

Suggest looking at this post here. It might help.

Math.ceil rounds up, Math.floor rounds down and Math.round rounds to the nearest integer.
__________________
David Miller
FusionPro VDP Creator 10.0.26
Adobe Acrobat Pro 2019.008.20074
Suitcase Fusion 20.0.0 (7653)
macOS High Sierra 10.13.6
Reply With Quote
  #3  
Old March 11th, 2015, 08:06 AM
dreimer dreimer is offline
Senior Contributor
 
Join Date: Oct 2010
Location: Shakopee, MN
Posts: 465
Default Re: Rounding Up

Sorry when I searched the forums I saw the title rounding to the nearest 5 so I didn't think it applied. Lesson learned, look at the thread anyway.

Thanks this works perfectly.
__________________
Don Reimer - JavaScript Novice

MAC OS 10.12.5 Acrobat XI 11.0.0 FP Creator 10.0.16
Windows 7 Acrobat X 10.1.4 FP Creator 9.3.9
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:49 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.