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 number by thousand

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Round number by thousand
 Login/Join
 
Member
posted
Hi folks,

A question on formatting numbers. In our reports, some number are big so I need round it by Thousand. For example:

12,345,678.91

will be round to 12,345

Is there a function or any way to do that?

Thanks very much!


George

WebFocus Developer Studio 7.6.0/BW 3.5/Servlet mode
 
Posts: 17 | Registered: February 05, 2007Report This Post
Virtuoso
posted Hide Post
Used to do something like:
DEFINE FILE CAR
R_RCOST/I4=(RCOST+499)/1000;
END
TABLE FILE CAR
PRINT R_RCOST RCOST
END

But you use an example in your code which is not rounded, 12,345,678.91 should round to 12,346. Otherwise it is just an integer of the value.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
Hi Alan,

Thank you for answering my question. Yes, you are right. 12,346 should be the right one.

I am not sure how to apply your code in my report. I am writing a report based on BW query in the Report designer. I can see the text for the report. Here is the code:

TABLE FILE Q_BPO_DUPUR_M01_MLAQL_QS9004
SUM
PO_COUNT/D18
PO_ITEM_COUNT
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET AUTODRILL ON
ON TABLE SET OLAPPANE TOP
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
RIGHTGAP=0.125000,
$
TYPE=DATA,
COLUMN=N1,
STYLE=ITALIC,
$
TYPE=TITLE,
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N1,
STYLE=ITALIC,
$
TYPE=TABHEADING,
SIZE=12,
STYLE=BOLD,
$
TYPE=TABFOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=HEADING,
SIZE=12,
STYLE=BOLD,
$
TYPE=FOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=SUBHEAD,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBFOOT,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBTOTAL,
BACKCOLOR=RGB(210 210 210),
$
TYPE=ACROSSVALUE,
SIZE=9,
$
TYPE=ACROSSTITLE,
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
BACKCOLOR=RGB(210 210 210),
STYLE=BOLD,
$
ENDSTYLE
END

My question is where I can put your code in.

Thanks you very much!


George

WebFocus Developer Studio 7.6.0/BW 3.5/Servlet mode
 
Posts: 17 | Registered: February 05, 2007Report This Post
Expert
posted Hide Post
Does anyone remember a SCALE element in an MFD? you could specify SCALE=1000 and it would adjust the store valued accordingly?
very fuzzy gray matter being rustled by this question...




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
Virtuoso
posted Hide Post
George

It depends. If you want the rounding to work on individual field values then use a DEFINE, if you want the rounding to work on a SUMmed value then use a COMPUTE
DEFINE FILE Q_BPO_DUPUR_M01_MLAQL_QS9004
IND_FIELD_ROUNDED/I8=(FIELD TO BE ROUNDED+499.99)/1000;
END
TABLE FILE Q_BPO_DUPUR_M01_MLAQL_QS9004
SUM
PO_COUNT/D18
PO_ITEM_COUNT
IND_FIELD_ROUNDED
HEADING
""
FOOTING
""
.
.
END

OR
TABLE FILE Q_BPO_DUPUR_M01_MLAQL_QS9004
SUM
PO_COUNT/D18
PO_ITEM_COUNT
COMPUTE SUM_FIELD_ROUNDED/I8=(FIELD_TO_BE_ROUNDED+499.99)/1000;
HEADING
""
FOOTING
""
.
.
END


I would generally think that a compute would be better, otherwise you loose too much value if you are doing a SUM on a rounded field. If you were using PRINT, then a DEFINE would be adequate (in general). Slight change, I remember needing to use the 499.99, not 499.

(Susannah, that's the weirdest thing, but there was something , back in the '80s?)

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
What I can say, I always get great help from this site.

Have a great weekend!


George

WebFocus Developer Studio 7.6.0/BW 3.5/Servlet mode
 
Posts: 17 | Registered: February 05, 2007Report This Post
Member
posted Hide Post
OK, I changed my code to use 499.99. It is just what I need. From this question, I learn something new, I will learn more stuff about Focus Language.

Thanks again, Alan!


George

WebFocus Developer Studio 7.6.0/BW 3.5/Servlet mode
 
Posts: 17 | Registered: February 05, 2007Report This Post
Platinum Member
posted Hide Post
You can use a virture filed in define, such as
DEFINE FILE FILENAME
NEWFIELD/I5C=INT(VALUE/1000);
END

TABLE FILE FILENAME
PRINT NEWFIELD AS 'FIELDNAME, $1000'
.......
END

If you use AS phase, you can print the column heading in two lines by using comma separator to indicate the unit is $1000.
 
Posts: 118 | Location: Omaha, NE | Registered: June 12, 2003Report 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 number by thousand

Copyright © 1996-2020 Information Builders