Focal Point
[SOLVED] cannot get dashes (/) in date format

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

August 10, 2011, 11:16 AM
paulux99
[SOLVED] cannot get dashes (/) in date format
Hello,
For a date field, I am trying to show the dashes (/).
Currently I am getting:
[ Latest Amendment #: 010 ] [ Amendment date: 03302011 ] [ Reason for Amendment: Change Contract ]

I am using the code below:


AMENDDT1/A8MDYY = IF CA_AMEND_REV_DATE NE ' ' THEN DATECVT(CA_AMEND_REV_DATE ,'MDY','A8MDYY') ELSE ' N/A ';

AMEND_DATA/A300 = ' [ Latest Amendment #: ' | CA_AMEND_REV1 ||' ] ' | ' [ Amendment date: ' |AMENDDT1 ||' ] ' | ' [ Reason for Amendment: ' | AMEND_REASON||' ] ';

any suggestions to show the dashes as follows:
[ Latest Amendment #: 010 ] [ Amendment date: 03/30/2011 ] [ Reason for Amendment: Change Contract Clause ]

This message has been edited. Last edited by: Kerry,
August 10, 2011, 11:53 AM
ERINP
paulux99,
One way of doing it would be to use the following logic: Instead of an A8MDYY field use an A10 field like:
COMPUTE AMENDDT1/A10 = IF CA_AMEND_REV_DATE NE ' ' THEN 
EDIT(CA_AMEND_REV_DATE,'99$$$$$$') ||'/'|| EDIT(CA_AMEND_REV_DATE, '$$99$$$$') ||'/'|| EDIT(CA_AMEND_REV_DATE, '$$$$9999')
ELSE ' N/A '; 
  

Using the EDIT will keep this as a 2 digit day, 2 digit month, and a 4 digit year.

Hope this helps


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
August 10, 2011, 11:54 AM
PBrightwell
Well, if nothing else works you can do an edit

AMENDDT1/A10 = IF CA_AMEND_REV_DATE NE ' ' THEN EDIT(CA_AMEND_REV_DATE,'99/99/9999') ELSE '';


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
August 10, 2011, 06:26 PM
Waz
FYI


The reason for lack of slashes is because the format of the field is A8MDYY. With this format the date is stored as an 8 character string, and the slashes are added when the column is shown in a report.

Therefore to add the date to another string with the slashes in place, the slashes will have to be added.


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!

August 11, 2011, 08:46 AM
paulux99
thanks for all the suggestion. The following seems to work:
DEFINE FILE ...
AMENDDT/A8MDYY = IF CA_AMEND_REV_DATE NE ' ' THEN DATECVT(CA_AMEND_REV_DATE ,'MDY','MDYY')
ELSE ' N/A '
END
TABLE FILE ...
SUM
COMPUTE AMENDDT1/A10 = IF AMENDDT NE ' ' THEN EDIT(AMENDDT,'99/99/9999') ELSE '';
AMENDDT
ON TABLE HOLD
END
DEFINE FILE HOLD
AMEND_DATA/A300 = ' [ Latest Amendment #: ' | CA_AMEND_REV1 ||' ] ' | ' [ Amendment date: ' |AMENDDT1 ||' ] ' | ' [ Reason for Amendment: ' | AMEND_REASON||' ] ';
END
August 11, 2011, 10:09 AM
ERINP
paulux99,
In your DEFINE If the AMENDDT is blank the format of A8MDYY will not like the value of 'N/A' from the ELSE statement. This may throw an error saying the value is incompatible with the format of the field.

A format of A10 will accept a value of 'N/A'.

ERINP


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files