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.
I thought I found rounding function (ROUND(infield, number, outfield) in another posting. Can someone let me now how this function works? I'm trying to round a number to the nearest 5.
Thanks, Bethany
WF 7.1.3 DevStudio 7.1.4
Server Environment: Win2K3 Server WebFOCUS 7.13 Apache Tomcat standalone application server
I'm not familiar with a ROUND function, are you trying to round numbers that are defined with decimal places already? If so it's been my experience that FOCUS does round. If it's integers that is a 'horse of a different color' as they say. Those truncate as the normal processing.
Leah
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004
Is there a function that allow you to round a number to the nearest 5? If the number is 127.33 then you'd round down to 125.00, or if you had 188.2 then you'd round up to 190.00?
Server Environment: Win2K3 Server WebFOCUS 7.13 Apache Tomcat standalone application server
There isn't a function to do that, but you could do it with an easy DEFINE or COMPUTE:
DEFINE FILE CAR RCOSTDIV5/P12=RCOST/5; RCOSTRND5/D12=RCOSTDIV5*5; END TABLE FILE CAR PRINT CAR RCOST RCOSTDIV5 RCOSTRND5 END
The value of the first field must be packed (vs. integer or floating) in order to round correctly. This is because I truncates and D or F stores decimals internally so no rounding would occur.
The field RCOSTRND5 is rounded to the nearest 5.
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
and to take Darin's idea one step further define a function and put it in your edasprof so its available to you whenever you need it.
DEFINE FUNCTION F_FIVES(INPUT/D7.2)
temp/P7=INPUT/5 ;
F_FIVES/D7.2=temp*5;
END
-* now this function is available to any fex without having to code it every time
DEFINE FILE CAR
FIRST/D7.2 WITH COUNTRY = 124.33 ;
SECOND/D7.2=F_FIVES(FIRST);
END
-RUN
TABLE FILE CAR
PRINT FIRST SECOND
END
Expand the concept, if you routinely round to other multiples;
DEFINE FUNCTION F_MROUND(INPUT/D7.2,TUPLES/I1)
temp/P7=INPUT/TUPLES ;
F_MROUND/D7.2=temp*TUPLES;
END
MROUND being a microsoft word, and therefore perhaps consistent w/ memory. and then the syntax to use it..
NEWNUMBER/D7.2=F_MROUND(oldnumber,5);
note: I've adopted Tony's suggestion that we use the syntax F_ to begin all our functions. Also have alook at the IMOD function, and its partners, DMOD, etc. Might give you ideas for the future; I used to use these MOD functions to do rounding, but Darin's way is *so* much cooler. Thanx DarinThis message has been edited. Last edited by: susannah,
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003