Focal Point
[SOLVED] Trouble with changing date format

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

May 05, 2015, 11:22 AM
lewiswhite1994
[SOLVED] Trouble with changing date format
Hello all,

I am having trouble converting the date format on one of my report fields.

I have added the following line in my .fex:

-SET &YM=EDIT(&DATE,'9999-99-99 99:99:99');

The report data that I am working with comes in the following format (here is an example):

2015/02/17 15:42:37.087


When I run the report to test, I get the following error:

0 ERROR AT OR NEAR LINE 5 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: 05/0-5/-15
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT


Any help would be greatly appreciated! Please let me know if you need any clarification on what I am trying to do.

Thanks,
Lewis

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


WebFOCUS 8
Windows, All Outputs
May 05, 2015, 11:45 AM
MartinY
Hi Lewis,

&DATE
is a reserved word in Focus

Try this and you will see the reason of your result:
-TYPE &DATE
-SET &YM=EDIT(&DATE,'9999-99-99 99:99:99');
-TYPE &YM


Use another variable name and it must work.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
May 05, 2015, 06:28 PM
Waz
Lewis, Check out the Functions manual, the EDIT function uses '9' for accept and '$' for reject.

You will need to add '$' to remove the slashes, colons and periods.

Also can you post the focus code, your error says FIELDNAME IS NOT RECOGNISED, which looks like it is in a TABLE request.


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!

May 07, 2015, 11:27 AM
lewiswhite1994
Thank you for your responses! The next part of my question was to be able to view the fields but one hour in the past.

I have managed to get this to work with the following code:

TABLE FILE ECM_KPI_IVU_TRANS_T
PRINT STATS_TIME
COMPUTE
MGHT/HYYMDS = HADD(STATS_TIME, 'HOUR', -1, 8, 'HYYMDS');
WHERE RECORDLIMIT EQ 2
END

When I run the .fex, I do get a column with the time correctly one hour in the past, however, the format still shows seconds.
How can I get rid of the seconds? Here is the output (First column is above, and second column is shown below it):

STATS_TIME
2015/02/17 15:42:37:087
2015/02/17 15:42:37:087

MGHT
2015/02/17 14:42:37
2015/02/17 14:42:37

Thanks in advance


WebFOCUS 8
Windows, All Outputs
May 07, 2015, 11:52 AM
MartinY
Try
MGHT/HYYMDI



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
May 07, 2015, 06:36 PM
Waz
You should check out the manuals on describing data.

e.g. Display Options


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!

May 08, 2015, 05:00 AM
lewiswhite1994
MGHT/HYYMDI worked perfectly, thank you MartinY!


WebFOCUS 8
Windows, All Outputs