Focal Point
[SOLVED] convert character date of mm/dd/yyy format to date format of mm/dd/yyyy

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7337070116

October 13, 2011, 05:23 PM
Brenda Wilkerson
[SOLVED] convert character date of mm/dd/yyy format to date format of mm/dd/yyyy
I have a master file date in char (A20V) format of mm/dd/yyy. I need to convert it to yymmdd so I can select MIN date.

I tried this (one of many trys)

DEFINE FILE WKFLOW_DOC_TYPE_FACT

OldEndDate/A20=CHGDAT('MDYY', 'YYMD',WKFLOW_DOC_TYPE_FACT.WKFLOW_DOC_TYPE_FACT.DISPLAYMMYY, 'A8');
END

And when I use is it is blank..
Any help is greatly appreciated

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



WebFOCUS 7.7.03
Windows 7
October 13, 2011, 05:49 PM
Francis Mariani
quote:
mm/dd/yyy

More details please: Does it contain slashes? It's not really yyy, is it?


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
October 13, 2011, 05:49 PM
Waz
quote:
mm/dd/yyy


How is the date formatted ?

Do you have an example ?


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!

October 13, 2011, 05:57 PM
Brenda Wilkerson
Sorry, got carried with my y's

It is formated st follows:
09/29/2011



WebFOCUS 7.7.03
Windows 7
October 13, 2011, 06:07 PM
Francis Mariani
So, just to be sure, that A20V column has data that contains the slashes?

If so, try the following:
 
TABLE FILE CAR
PRINT
COMPUTE DISPLAYMMYY/A20V = '09/29/2011';
COMPUTE OLDENDDATE1/A8MDYY = EDIT(DISPLAYMMYY,'99$99$9999');
OLDENDDATE/YYMD = OLDENDDATE1;
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
October 14, 2011, 09:50 AM
Gizmo
Why not just do the conversion in the master?

FIELDNAME=VDATE, ALIAS=E02, USAGE=MDYY, ACTUAL=A20V, DATEPATTERN='[MM]/[DD]/[YYYY]', $

Having the DATEPATTERN will allow you to set the usage to what ever you need: YYMD, MtrDYY, etc.



Windows: WF 7.6.2: SQL Server 2008 R2
October 14, 2011, 10:01 AM
Brenda Wilkerson
I tried your example and When I clcked the run button it doesn't run, there are no errors. I also found that there are some records that are mm/dd (01/23).

My code below, maybe I am missing something?

TABLE FILE WKFLOW_DOC_TYPE_FACT
COMPUTE DISPLAYMMYY/A20V = '09/29/2011';
COMPUTE OLDENDDATE1/A8MDYY = EDIT(DISPLAYMMYY,'99$99$9999');
OLDENDDATE/YYMD = OLDENDDATE1;
SUM
WKFLOW_DOC_TYPE_FACT.WKFLOW_DOC_TYPE_FACT.OLDENDDATE
J3.TRAN_TYPE_DIM.TRAN_TYPE_NM
WKFLOW_DOC_TYPE_FACT.WKFLOW_DOC_TYPE_FACT.DISPLAYMMYY
WKFLOW_DOC_TYPE_FACT.WKFLOW_DOC_TYPE_FACT.ACTIVE
WKFLOW_DOC_TYPE_FACT.WKFLOW_DOC_TYPE_FACT.PEND
BY LOWEST J0.USER_DIM.USER_ID
BY LOWEST J2.NODE_DIM.NODE_NM
BY LOWEST WKFLOW_DOC_TYPE_FACT.WKFLOW_DOC_TYPE_FACT.DISPLAYMMYY NOPRINT
WHERE J3.TRAN_TYPE_DIM.TRAN_TYPE_CD EQ 'E';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
TYPE=REPORT,
COLUMN=N1,
SQUEEZE=1.680556,
$
TYPE=REPORT,
COLUMN=N2,
SQUEEZE=1.430556,
$
ENDSTYLE
END



WebFOCUS 7.7.03
Windows 7
October 14, 2011, 10:55 AM
Brenda Wilkerson
Got it resolved. Put it in a define and date is converted.

Thx all for you help Smiler



WebFOCUS 7.7.03
Windows 7
October 14, 2011, 11:23 AM
Mary Watermann
Brenda,

quote:

TABLE FILE WKFLOW_DOC_TYPE_FACT
COMPUTE DISPLAYMMYY/A20V = '09/29/2011';
COMPUTE OLDENDDATE1/A8MDYY = EDIT(DISPLAYMMYY,'99$99$9999');
OLDENDDATE/YYMD = OLDENDDATE1;
SUM



You have the COMPUTEs BEFORE the verb (SUM). Move the computes AFTER the SUM or add another verb (SUM) before the computes.


WF 7.6.10, Windows, PDF, Excel
October 16, 2011, 04:34 PM
Waz
quote:
DATEPATTERN


Very interesting, and quite useful.

Good One


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!

October 17, 2011, 09:57 AM
Francis Mariani
quote:
DATEPATTERN

Yes, that is interesting - it must be v7.7...


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
October 17, 2011, 04:42 PM
Waz
Docco says 7.6


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!

October 17, 2011, 04:46 PM
Doug
Nice Thread
quote:
DATEPATTERN ... Yes, that is interesting
Cool It may be 7.6, but, it's new to me...