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]Alpha to numeric format

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Alpha to numeric format
 Login/Join
 
Guru
posted
Hi,

I have an alpha field(A40V) with the values such as (12.50%,2,89%,5.00% etc) and I want to change it to a numeric field.

Iam using the below code/logic but nothing seems to be working :
 DEFINE FILE NEW_TABLE
NEW_FIELD2/D12.2 = ATODBL(FIELD2,'40',NEW_FIELD2);

END

TABLE FILE NEW_TABLE
PRINT
FIELD2
COMPUTE NEWER_FIELD/P12.2=NEW_FIELD2;
END
-RUN

This is the output which Iam getting :

FIELD2 	NEWER_FIELD
12.50%	.00
2.89%	.00
5.00%	.00
.... 


Could anyone please let me know how to convert from alpha to numeric retaining the %'s ?
Please let me know.

Thanks a lot in advance for all the help.

Regards,
IP

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


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Platinum Member
posted Hide Post
This is being very basic and would be learn in training.

Look for how use number format in document.

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 106 | Registered: April 06, 2009Report This Post
Guru
posted Hide Post
Hi Kofi,

In FPRINT,the output format should also be alphanumeric and I want my output format in numeric.

Please let me know.

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Platinum Member
posted Hide Post
Look in documents for USAGE (same use for DEFINE and COMPUTE also) and learn how use percent sign on number.

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 106 | Registered: April 06, 2009Report This Post
Virtuoso
posted Hide Post
USAGE is good when your data is read from a master file.
If it comes from a HOLD file or defined in your TABLE FILE, you may not have a master from which you can change the USAGE.

This can do the job.
To have EDIT converting an "alpha-number" to a number, it must not have any spaces or special characters.
Sometimes you need to play with several functions and try stupid things to get what you need.
DEFINE FILE CAR
PCTA /A10V    = DECODE COUNTRY ('ENGLAND' '10.5%' 'FRANCE' '15.28%' 'ITALY' '-5.00%' 'JAPAN' '.05%' ELSE '100%');
PCTX /A10V    = TRIMV('B', CTRAN (10, PCTA, 37, 32, 'A10V'), 10, '', 1, 'A10V');
PCTD /D10.2%C = EDIT(TRIMV('B', CTRAN (10, PCTA, 37, 32, 'A10V'), 10, '', 1, 'A10V'));
END
TABLE FILE CAR
PRINT PCTA
      PCTX
      PCTD
BY COUNTRY
END
-RUN

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


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
Guru
posted Hide Post
Hi Martin,

I actually want to convert the PIVOTFLD field
in this post which is in A40 format to numeric so that I can use it for my graph.
http://forums.informationbuild...1057331/m/4357087586

In this case, I can't use decode also as suggested in your example since I have multiple values right ?

Please let me know.

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Virtuoso
posted Hide Post
The DECODE was there only to create data as for the sample since no data similar to yours exist in IBI sample files.

In your case PCTA is replaced by PIVOTFLD in the PCTD field definition.

You need to analyse a little more and think "what can be applied to my case from the provided sample".

From all the posts regarding that report/graph "issue", I gave you all what you need to have the result.
I think that from this point, you have to think and work by yourself.
Try stuff, do more search, make errors and try back. You have all you need already.

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


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
quote:
PCTD /D10.2%C

Exactly!!! Learn number format by reading manual and document and not expect people do for you.

You lucky Martin so keen to answer and do your work!!

quote:
Look in documents for USAGE (same use for DEFINE and COMPUTE also) and learn how use percent sign on number.

Martin, USAGE OK on synonym as you say. Is why I say same use for DEFINE and COMPUTE. I try give enough to help go forward but not complete answer - this way IP may learn??

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 106 | Registered: April 06, 2009Report This Post
Virtuoso
posted Hide Post
It's right Kofi, but using format attributes may not be enough since it may not converting from one type to another.
Often it's just a display feature attribute.


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
Guru
posted Hide Post
Hi,

Thanks Kofi Smiler

Martin - Thanks a million for all your help and you are a rockstar Smiler Your knowledge is vast and incredible!!

Once again thanks for all the help!

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Platinum Member
posted Hide Post
quote:
for DEFINE and COMPUTE

I not suggest dynamic reformat, only DEFINE and COMPUTE.

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 106 | Registered: April 06, 2009Report This Post
Expert
posted Hide Post
Seems to me that if you want to use ATODBL, and there is a % in it, just strip out the %.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Guru
posted Hide Post
Hi,

Sure Kofi and Waz...I will use your techniques as well!

Thanks a lot once again for looking into this Smiler

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report 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]Alpha to numeric format

Copyright © 1996-2020 Information Builders