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     [SOLVED] Adding K or M or B after Rounding Number Dynamically

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Adding K or M or B after Rounding Number Dynamically
 Login/Join
 
Gold member
posted
I have a report and I need to show the amount in Millions or Billions or in K’s dynamically. Is that possible to add after rounding number like M or B or K?

Ex: if Sales is 100000 then I need to show 100K

Ex: if Sales is 1000001 then I need to show 1.1M

Any Example appreciated

This message has been edited. Last edited by: <Kathryn Henning>,


WebFocus 8202M
APP Studio
Info assist
Report caster
Portals
Maintain
EXcel,PDF,HTML,Active Reports
 
Posts: 82 | Location: MD | Registered: May 14, 2010Report This Post
Virtuoso
posted Hide Post
That's an odd way of rounding.

But whatever your rounding method, here's a sketch (untested!):
define file ...
-* first compute the rounded values, for example... (P format ensures wysiwyg)
sales /P12.1 = sales_field;
salesk/P12.1 = sales / 1000 ;
salesm/P12.1 = sales / 1000000 ;
salesb/P12.1 = sales / 1000000000 ;
-* determine the scale factor (and suffix) for displaying the value
sales_type/A1=
     if abs(salesb) gt 0 then 'B'
else if abs(salesm) gt 0 then 'M'
else if abs(salesk) gt 0 then 'K'
else ' ';
-* ... and the scaled value
sales_value/D12.1=
     if sales_type eq 'B' then salesb
else if sales_type eq 'M' then salesm
else if sales_type eq 'K' then salesk
else sales;
sales_display/A16 = fprint(sales_value, '(D12.1)', 'A15') | sales_type ;
end


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
Perfect, That works.
only I relaced following in your code.

SALES_VALUE_A/A25 = FTOA(SALES_VALUE,'(D12.1)',SALES_VALUE_A);

Thanks Gross.


WebFocus 8202M
APP Studio
Info assist
Report caster
Portals
Maintain
EXcel,PDF,HTML,Active Reports
 
Posts: 82 | Location: MD | Registered: May 14, 2010Report 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     [SOLVED] Adding K or M or B after Rounding Number Dynamically

Copyright © 1996-2020 Information Builders