Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Round up to next whole number

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Round up to next whole number
 Login/Join
 
Platinum Member
posted
Hi all,

I need the result of a calculation to always round up to the next whole number.

Example: I need to work out how many weeks a given number of days spanned:

So I need 22/7 to equal 4 not 3.14285 or 3.

Thanks

Mark


WebFocus 765. iSeries v5r4
 
Posts: 175 | Location: England | Registered: April 11, 2006Report This Post
Virtuoso
posted Hide Post
This is an IBI example

DEFINE FILE CAR
ROUND1/D10.2 = RCOST/1000;
ROUND2/D5= INT(ROUND1+1) ;
END
TABLE FILE CAR
PRINT CAR RCOST ROUND1 ROUND2
END


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Virtuoso
posted Hide Post
Looks as if you need to do some math figuring, if you calculate in decimal mode add .9 to the answer and then convert the output to integer which truncates would that work? In math terms

3.12285 + .9 = 4.02285 integer is 4
3.5 + .9 = 4.5 integer is 4

might work for you.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Platinum Member
posted Hide Post
Many thanks Prarie & Leah.

Looks like you both came along at the same time with different solution, both of which work great for me.

I knew it would be something simple, but I was getting hung up on the ROUND function.

Thanks again Smiler


WebFocus 765. iSeries v5r4
 
Posts: 175 | Location: England | Registered: April 11, 2006Report This Post
Virtuoso
posted Hide Post
Mark,
If you always want to round up then you have to beware of two possibilities:
1. your number is a whole number to begin with
2. your number is slightly over a whole number.
I suggest, if your original field is FIELD/D8.2:
WFIELD/D8=INT(FIELD);
UPFIELD/D8=IF FIELD EQ WFIELD THEN FIELD ELSE WFIELD + 1;


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Platinum Member
posted Hide Post
Thanks Danny,

I hadn't spotted that. 7 ÷ 1 was equal to 2, not 1. Now corrected.


WebFocus 765. iSeries v5r4
 
Posts: 175 | Location: England | Registered: April 11, 2006Report This Post
Expert
posted Hide Post
I might consider a refinement
use one of the MOD functions (DMOD,FMOD,IMOD)
to determine whether or not your remainder really is zero.
Just comparing the FIELD to the WFIELD
isn't quite reliable, because that FIELD may appear to be 8.0 and its integer value ,8, would equal WFIELD, however these D fields carry decimal leave-behinds way down in the 32nd digit (or however far they really go internally ) so a MOD of FIELD/WFIELD will either equal 0 if they are truly equal
or not 0, if they're even a negligible bit off.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
Try
xdefine/d8.2 = database_field + .05;
ydefine/d8 = int(xdefine);


ira w. 5.3.6 aix 533


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
 
Posts: 195 | Registered: October 27, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Round up to next whole number

Copyright © 1996-2020 Information Builders