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  iWay Software Product Forum on Focal Point    [CLOSED] Converting YYMD (data) to YYYYMMDD (integer)
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Converting YYMD (data) to YYYYMMDD (integer)
 Login/Join
 
Gold member
posted
Any thoughts on how to do this? I want to take 2016-01-12 (YYMD) to turn into 20160112 (integer).

I tried taking

DPART(DATE,YEAR) | DPART(DATE,MONTH) | DPART(DATE,DAY)

But that threw an error, expecting alpha fields.

Then I tried

EDIT(DPART(DATE,YEAR)) | EDIT(DPART(DATE,MONTH)) | EDIT(DPART(DATE,DAY))

And that just gave me jibberish. Any thoughts?

This message has been edited. Last edited by: FP Mod Chuck,


WebFocus 8.104
Windows 7 Entreprise, SP1
 
Posts: 70 | Location: Abbotsford BC | Registered: March 15, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Hi Max,
Did you try NEW_DATE/I8 = YOUR_YYMD_DATE_FIELD;
If that doesn't work, try the FPRINT function...
Tom


Tom Flynn
WebFOCUS 7.7.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1934 | Location: Parker, CO | Registered: January 31, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
quote:
NEW_DATE/I8 = YOUR_YYMD_DATE_FIELD;

Better,
NEW_DATE/I8YYMD = YOUR_YYMD_DATE_FIELD;
 
Posts: 1924 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
Good suggestion Tom.

Trying NEWDATE/I8 = DATEFIELD gave me a 5 digit number conversion, which wasn't I needed unfortunately.

FPRINT(DATEFILED, 'YYMD','I8')

gave the error:

1 FILE(S) LOADED
0 ERROR AT OR NEAR LINE 10 IN PROCEDURE TEST_TRN58FOCEXEC *
(FOC36355) INVALID TYPE OF ARGUMENT #3 FOR USER FUNCTION FPRINT
(FOC101) ERROR IN DEFINE IN MASTER FILE: TABLE_NAME
BYPASSING TO END OF COMMAND

So then I just got fancy and over-engineered the function.

EDIT(SUBSTV(10, FPRINT(START_DATE, 'YYMD', 'A10'),1,4,'A4') | SUBSTV(10, FPRINT(START_DATE, 'YYMD', 'A10'),6,7,'A2') | SUBSTV(10, FPRINT(START_DATE, 'YYMD', 'A10'),9,10,'A2'))

Maybe more work than necessary, but gets the job done. Thanks for the help!


WebFocus 8.104
Windows 7 Entreprise, SP1
 
Posts: 70 | Location: Abbotsford BC | Registered: March 15, 2010Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
Originally posted by j.gross:
quote:
NEW_DATE/I8 = YOUR_YYMD_DATE_FIELD;

Better,
NEW_DATE/I8YYMD = YOUR_YYMD_DATE_FIELD;


That keeps the "/" which I want to get rid of.


WebFocus 8.104
Windows 7 Entreprise, SP1
 
Posts: 70 | Location: Abbotsford BC | Registered: March 15, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
That keeps the "/" which I want to get rid of.


That is a formatted integer.

Just assign result to an I8 field


Waz...

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

 
Posts: 5917 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Need to use I8YYMD

 TABLE FILE systable
 PRINT NAME NOPRINT
 COMPUTE SOMEDAY/YYMD    = 20131211;
 COMPUTE SOMEDAY2/I8YYMD = SOMEDAY;
 COMPUTE SOMEDAY_I8/I8   = SOMEDAY2;
 WHERE RECORDLIMIT IS 1
 END  


WF 8.2.03
Win10 / IE11
AHTML EXL2K PDF COMT WP ZIP
 
Posts: 126 | Registered: October 19, 2010Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Try using the DATECVT function:
https://webfocusinfocenter.inf...r/source/datecvt.htm

 INT_DATE/I8 = DATECVT ( YYMD_DATE, 'YYMD', 'I8YYMD'); 


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 217 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] Converting YYMD (data) to YYYYMMDD (integer)

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