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] Converting Alpha to Decimal

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Converting Alpha to Decimal
 Login/Join
 
Gold member
posted
How to convert Alpha TO Decimal value.
  
-SET &VARIABLE1 = '258,123.25'

How to convert the above Value into Integer..?



WF 7.6
IIS
HTMl Excel, PDF

This message has been edited. Last edited by: Kerry,


Prod: WF 7.6.10 windows. -- MRE/Dashboard/Self Service/ReportCaster - Windows XP
 
Posts: 82 | Location: Chicago | Registered: September 28, 2005Report This Post
Virtuoso
posted Hide Post
Do a search on ATODBL..that should help you out.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Expert
posted Hide Post
-SET &ECHO=ALL;

SET DMPRECISION = 2
-RUN

-SET &VAR1 = 258123.25;
-SET &VAR2 =  &VAR1 * 1;

-TYPE &VAR1 &VAR2


Look at WebFOCUS/iWay New Features > Reporting Language > Specifying Precision for Dialogue Manager Calculations


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Thank you for response..
I guess my question was interpretted wrong.

Variable has Alpha value ie:25,258.12

&VAR/A15 = '25,258.12' ;
I want to convert this comma seperated Alpha value to Decimal, so that I perform some computations.

Conversion from alpha to Decimal
'25,258.12' --> 25258.12

Thanks


Prod: WF 7.6.10 windows. -- MRE/Dashboard/Self Service/ReportCaster - Windows XP
 
Posts: 82 | Location: Chicago | Registered: September 28, 2005Report This Post
Expert
posted Hide Post
Prarie gave you the answer, however you will have to preprocess the alpha value to remove commas.

However, by the time you've stripped (hint) out the comma(s) you could then just use Francis' suggestion as it is a variable (which doesn't really have a format).

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
Always an interesting one this. For calculations in DM, always done in double precision, but displayed truncated unless DMPRECISION is used.

ATODBL, which seems to be needed and cannot take commas in the input string, is not needed. &variables are what they contain(ish).

So get rid of the commas, using STRREP, then the variable can be used in calculations.

The redisplay is then an issue, as 123456.70 displays as 123456.7, so use FTOA to get a full 2 decimal point display.

THEN decide how you want the result of a calculation displayed. Using F10.2 truncates the decimals and D10.2 rounds the decimals, but then D10.2 will also add the comma in and F10.2 doesn't. Go figure which you want.

SET DMPRECISION = 2
-RUN

-SET &VAR1 = '258,123.25';
-SET &LEN1 = &VAR1.LENGTH;
-SET &VAR2 = STRREP(&LEN1,&VAR1,1,',',0,'X',&LEN1,'A&LEN1.EVAL');
-SET &VAR3 = &VAR2*1.23;
-SET &VAR4 = FTOA(&VAR3,'(F10.2)','A16');
-SET &VAR5 = FTOA(&VAR3,'(D10.2)','A16');

-TYPE &VAR2 &VAR3 &VAR4 &VAR5 

gives
258123.25 317491.6 317491.59 317,491.60

The actual full precision result is 317491.5975


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Exactly Alan, but I would have used STRIP instead of STRREP -

-SET &VAR2 = STRIP(&VAR1.LENGTH, '&VAR1.EVAL', ',', 'A&VAR1.LENGTH');

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Gold member
posted Hide Post
Thanks Alan B
Your solution is crystal clear.

Thanks


Prod: WF 7.6.10 windows. -- MRE/Dashboard/Self Service/ReportCaster - Windows XP
 
Posts: 82 | Location: Chicago | Registered: September 28, 2005Report 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] Converting Alpha to Decimal

Copyright © 1996-2020 Information Builders