Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Closed]Converting an int to a date or alpha
Go
New
Search
Notify
Tools
Reply
  
[Closed]Converting an int to a date or alpha
 Login/Join
 
Member
posted
Hi
I tried to convert an integer field(I11) (201501) to an alpha or a date. I need to get the format of January 2015. I tried different functions and nothing seems to work. Can anyone help me. Below is the functions I used to get the date.

COMPUTE PCPYear3 /A4 = EDIT(PGIP_PHYSCIANSLIST,'9999');
COMPUTE PGIP_MONTH/I2 = DTPART(PGIP_PHYSCIANSLIST, MONTH);
COMPUTE PGIP_YEAR/I4 = DTPART(PGIP_PHYSCIANSLIST, YEAR);
COMPUTE PGIPYear1/YYM =PGIP_PHYSCIANSLIST;
COMPUTE PGIPYear = SUBSTR(6,PGIP_PHYSCIANSLIST,1,4,4,'A4');

Thanks,
Sherly
The version I am using is 8.1.05
Windows 7 Enterprise

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


WebFocus 8.x
Hyperstage
 
Posts: 6 | Registered: June 16, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
DEFINE FILE CAR
MY_INT_FIELD/I11 WITH COUNTRY = 201501;

MY_YYMI/I6YYM = MY_INT_FIELD;
MY_YYM/YYM = MY_YYMI;
END

TABLE FILE CAR
SUM
SALES
MY_INT_FIELD
MY_YYMI
MY_YYM
BY 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, 2005Reply With QuoteReport This Post
Member
posted Hide Post
Hi Francis,
Do I need to hardcode the value of the date?
I tried the code below and the code failed

CStart_DT/I11 WITH PGIP_PHYSCIANSLIST = 201507;
My value should come from the table.

Sherly


WebFocus 8.x
Hyperstage
 
Posts: 6 | Registered: June 16, 2015Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Hi Sherly,

You might find answers to all those pesky date questions in Almost 1001 Ways to Work with Dates in WebFOCUS -- a handy book filled with examples! Available at www.aviter.com.


Vivian Perlmutter
Aviter, Inc.


WebFOCUS Keysheet Rel. 8.0.2
(Almost) 1001 Ways to Work with Dates thru Rel. 8.0.2
Focus since 1982
WebFOCUS since the beginning
Vivian@aviter.com

 
Posts: 191 | Location: Henderson, Nevada | Registered: April 29, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
Hi Sherly,
Welcome to the WebFOCUS Forum.

Try this:

COMPUTE DATE0/I6YYM = PGIP_PHYSCIANSLIST;
COMPUTE DATE1/A6YYM = EDIT(DATE0);
COMPUTE MONTH_YR/A17 = LCWORD(17, CHGDAT('YYMD','MXYY',DATE1,'A17') ,'A17');


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1969 | Location: Centennial, CO | Registered: January 31, 2006Reply With QuoteReport This Post
Member
posted Hide Post
it is working. Thank you so much for your help
Sherly


WebFocus 8.x
Hyperstage
 
Posts: 6 | Registered: June 16, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Hi Sherly,

Can you update the title of your first port in this thread to add [CLOSED] or [SOLVED] if you are happy with the answer.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6272 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
"Do I need to hardcode the value of the date"

Sherly, since the CAR file doesn't have a date column, I had to concoct one. Of course the data can come from an existing column.


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, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Closed]Converting an int to a date or alpha

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.