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] DOUBLE TO ALPHANUMERIC

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] DOUBLE TO ALPHANUMERIC
 Login/Join
 
Member
posted
Hello all,

An alphanumeric field in my report was outputting for example, "945.5, 784.33, 1054.006". I need to set it to where all data is locked with three decimal places (i.e. "945.500, 784.330, 1054.006").

The way I am attempting to do this is to convert the field to DOUBLE with the set decimal places, and then convert back to ALPHANUMERIC. I have successfully converted the field to DOUBLE (using ATODBL )but I am having trouble converting back to ALPHA.

I appreciate all suggestions.

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8
Windows, All Outputs
 
Posts: 8 | Registered: November 02, 2015Report This Post
Expert
posted Hide Post
Unfortunately I don't think there's a WF field format to output trailing zeros.

I assume you have ONE alphanumeric field that contains THREE numeric values.

Here's a method of doing it without converting to a numeric format. It involves right-justifying the individual values to have a predictable decimal point position, then adding the appropriate number of zeros:

TABLE FILE CAR
PRINT
COMPUTE AN/A30 = '945.5, 784.33, 1054.006';

COMPUTE AN1/A30 = RJUST(30, GETTOK(AN, 30, 1, ',', 30, 'A30'), 'A30'); NOPRINT
COMPUTE AN2/A30 = RJUST(30, GETTOK(AN, 30, 2, ',', 30, 'A30'), 'A30'); NOPRINT
COMPUTE AN3/A30 = RJUST(30, GETTOK(AN, 30, 3, ',', 30, 'A30'), 'A30'); NOPRINT

COMPUTE AN1E/A40 = IF SUBSTR(30, AN1, 29, 30, 1, 'A1') EQ '.' THEN AN1 || '00' 
              ELSE IF SUBSTR(30, AN1, 28, 30, 1, 'A1') EQ '.' THEN AN1 || '0' ELSE AN1; NOPRINT
COMPUTE AN2E/A40 = IF SUBSTR(30, AN2, 29, 30, 1, 'A1') EQ '.' THEN AN2 || '00' 
              ELSE IF SUBSTR(30, AN2, 28, 30, 1, 'A1') EQ '.' THEN AN2 || '0' ELSE AN2; NOPRINT
COMPUTE AN3E/A40 = IF SUBSTR(30, AN3, 29, 30, 1, 'A1') EQ '.' THEN AN3 || '00' 
              ELSE IF SUBSTR(30, AN3, 28, 30, 1, 'A1') EQ '.' THEN AN3 || '0' ELSE AN3; NOPRINT

COMPUTE ANE/A130 = AN1E || ',' || (' ' | AN2E) || ',' || (' ' | AN3E);
BY LOWEST 1 COUNTRY
END


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
Member
posted Hide Post
Yes, sorry for not being specific enough. It is only one field and the example values (945.5, 784.33, 1054.006) would be separate values.

A coworker of mine found the solution to convert the original field A6 (alphanumeric) to DOUBLE D9.3 and use FTOA to return the values as A10. It works and thank you for your contribution as well.


WebFOCUS 8
Windows, All Outputs
 
Posts: 8 | Registered: November 02, 2015Report This Post
Expert
posted Hide Post
Look up the FPRINT function. it can take a funky value with commas and decimals and return a nice character string.
Is that what you're tryng to do?




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
  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] DOUBLE TO ALPHANUMERIC

Copyright © 1996-2020 Information Builders