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 a decimal number to alpha

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Converting a decimal number to alpha
 Login/Join
 
Platinum Member
posted
I want to convert a D20.2 field to alpha. This is a GPA value so always has the #.## format. I was wondering if this could be done in a DEFINE or a COMPUTE? I can do it in the master using the following expression but want to know if there is a better/more efficient way to do it, either in the master or using DEFINE's or COMPUTE's?

  
SUBSTRING(FPRINT(SYVSTAI_CUMULATIVE_GPA,'D20.2','A25'), 22, 4)


Thanks

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


WF8
Windows
 
Posts: 117 | Registered: May 28, 2015Report This Post
Virtuoso
posted Hide Post
Two ways you can do this, either use EDIT (it will zero fill the output) or use PTOA function.
DEFINE FILE ibisamp/car
 NEW_FIELD/A20=EDIT ( RCOST );
 PTOA_FLD/A20=PTOA(RCOST,'(P7)',PTOA_FLD);
END

TABLE FILE ibisamp/car
SUM RCOST
BY COUNTRY
BY NEW_FIELD
BY PTOA_FLD
END

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


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
DEFINE FILE X
ALPHAFMT /A25 = LJUST(FPRINT(SYVSTAI_CUMULATIVE_GPA,'D20.2','A25'));
END

To decide if it's better in a DEFINE or COMPUTE, it depend on the way you will use it.

Would you like to have all rows converted as alpha (use DEFINE) or just the extracted ones, meaning after Focus has performed the WHERE clause (use COMPUTE) ?
It's a more a question of performance.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
Thanks for the answers.....

The EDIT solution left zero fill in the output like you said it would
The PTOA solution did not work, it returned a blank field, I believe it did this because the field I was trying to convert was a D20.2
The LJUST(FPRINT()) solution worked but the parameters were different than what was indicated

This is what worked

LJUST(25,(FPRINT( (ACSTHOLD.ACSTHOLD.CUMULATIVE_GPA),'D20.2','A25')),'A6')

Thanks to you both, I learned a lot.


WF8
Windows
 
Posts: 117 | Registered: May 28, 2015Report 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 a decimal number to alpha

Copyright © 1996-2020 Information Builders