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     [SOLVED] CONVERSION OF MDYY filed
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] CONVERSION OF MDYY filed
 Login/Join
 
Master
posted
I have searched the forum and found numerous discussions but not one the gets me exactly what I need. I also have an online functions manual but I am still unable to get something to work. I have a view with a date of type MDYY. I need the day number from that field. Ex: July 13 , 2013 would yeild: 13.

I tried using EDIT and wrapping that in a SUBSTR function but got an incompatible type error.

Is there something simple?

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 572 | Registered: June 28, 2013Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Is your feild a date/numeric field or a text string?

If its a text string, you would first need to make sure that it is always the same format, i.e the month should always be three characters for consistency and the day should always be two chars, and then a simple edit with a mask should get you the day component.

If its a date/numeric field, try using the built in date functions (i.e HEXTR)


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Reply With QuoteReport This Post
Master
posted Hide Post
hovering over the field...Format: MDYY....was told its numeric...


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 572 | Registered: June 28, 2013Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
hovering over the field

Normally implies what the display format is. You need to know the actual format, found in the synonym or "?FF filename".
 
Posts: 3066 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Silver Member
posted Hide Post
Robert,
A Date type of MDYY often indicates a "SmartDate" datatype field.
You may extract individual components in this manner (SD_MDY2 is an MDY SmartDate field):
a)  YR1 /YY    = SD_MDY2;  
b)  MO1 /MONTH = SD_MDY2;  
c)  DA1 /DAY   = SD_MDY2;  
d)  QT1 /Q     = SD_MDY2;  
e)  WK1 /W     = SD_MDY2;  

Alternately, you may use the DPART function:
  a)  YR1 /YY    = DPART(SD_MDY2,'YEAR'   ,YR1);  
  b)  MO1 /MONTH = DPART(SD_MDY2,'MONTH'  ,MO1);  
  c)  DA1 /DAY   = DPART(SD_MDY2,'DAY'    ,DA1);  
  d)  QT1 /Q     = DPART(SD_MDY2,'QUARTER',QT1);  
  e)  YR2 /I4    = DPART(SD_MDY2,'YY',    'I4');  
  f)  MO2 /I2    = DPART(SD_MDY2,'MM',    'I2');  
  g)  DA2 /I2    = DPART(SD_MDY2,'DAY',   'I2');  
  h)  QT2 /I2    = DPART(SD_MDY2,'QQ',    'I2');  

This and more can be found in the "Dates Book" available at www.Aviter.com".

This message has been edited. Last edited by: John W Price,



WebFOCUS 8.0.2, FOCUS since 1977 - John@Aviter.com
PDF , Excel, FOCUS, Author of the Keysheets and Dates book.
www.Aviter.com
 
Posts: 40 | Registered: April 19, 2013Reply With QuoteReport This Post
Master
posted Hide Post
thanks.. I will try...


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 572 | Registered: June 28, 2013Reply With QuoteReport This Post
Expert
posted Hide Post
Several ways to do this:

DEFINE FILE CAR
TEST_DATE/MDYY = '03232011';
END

TABLE FILE CAR
PRINT
TEST_DATE
COMPUTE TEST_MONTH_I/I2 = DPART(TEST_DATE,'MM',    'I2'); 
COMPUTE TEST_MONTH_A/A02 = EDIT(FPRINT(TEST_DATE,'MDYY','A10'),'99$');
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
Expert
posted Hide Post
DATECVT?
 
Posts: 3066 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Master
posted Hide Post
Thanks all, when we get our server back I'll give it a go....


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 572 | Registered: June 28, 2013Reply With QuoteReport This Post
Expert
posted Hide Post
The simplest way is to DEFINE or COMPUTE a field with a format of D

TABLE FILE CAR
PRINT COMPUTE DATE_MDYY/MDYY = '07/31/2013' ;
COMPUTE DATE_DAY/D = DATE_MDYY ;
COMPUTE DAY_I2/I2 = DATE_DAY ;
COMPUTE DAY_A2/A2 = EDIT(DATE_DAY);

BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1
END


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: 6252 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Master
posted Hide Post
Cripes, Waz ... Please don't tell me they use that idiotic MDYY format down under ....


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
No, Never.......

Smiler


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: 6252 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
I'm in the middle here, but, what's wrong with the MDYY format?
 
Posts: 3066 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
what's wrong with the MDYY format


Can O worms ......

Big Grin


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: 6252 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Master
posted Hide Post
quote:
Originally posted by Waz:
quote:
what's wrong with the MDYY format


Can O worms ......

Big Grin


Except all of my users like dates displayed in mm/dd/yyyy format.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 950 | Location: Oklahoma City | Registered: October 27, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
all of my users like dates displayed in mm/dd/yyyy format

Store them as smart dates with usage format = mm/dd/yyyy. BTW: I like that format for display, not for storage or sorting. Fortunately, WebFOCUS has those two options in its Can O Worms.
 
Posts: 3066 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
all of my users like dates displayed in mm/dd/yyyy format


Well there you go, different "regions" like different formats.

In OZ its either YYYY/MM/DD or DD/MM/YYYY.

And other countries around the world its different again.

Thank be to the Smart Date gods.


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: 6252 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Master
posted Hide Post
Just wanted to thank you all...COMPUTE DATE_DAY/D = DATE_MDYY ;
is working.


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 572 | Registered: June 28, 2013Reply With QuoteReport This Post
Expert
posted Hide Post
Please edit your first post in this thread and add [SOLVED] to the title.


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: 6252 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] CONVERSION OF MDYY filed

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