Focal Point
[SOLVED] Converting today date to the day of the week
July 19, 2012, 12:54 AM
Sophie [SOLVED] Converting today date to the day of the week
Please help... I am 'new' to webfocus programming and I try to work out the day of the week from today date in order to decide what the program should do.
My code is as below. I am getting error message "Task error: UNRECOGNIZED COMMAND DATEA/A8YYMD = TODAY(DATEA);"
DATEA/A8YYMD = TODAY(DATEA);
DATEB/A4 = DOWK(DATEA, DATEB);
Thanks
This message has been edited. Last edited by: Kerry , July 26, 2012 12:09 PM WebFOCUS 5.2 upgrading to the latest version at the moment. UNIX HTML
July 19, 2012, 01:01 AM
Waz Instead of using TODAY(DATEA), use '&YYMD'.
Waz... Prod: WebFOCUS 7.6.10/8.1.04 Upgrade: WebFOCUS 8.2.07 OS: Linux Outputs: HTML, PDF, Excel, PPT In Focus since 1984 Pity the lost knowledge of an old programmer!
July 19, 2012, 01:11 AM
Sophie Thank you.
I tried your suggestion with the code below, but it's still prompting me the message "Task error: UNRECOGNIZED COMMAND DATEA/A8YYMD = 20120719 ;"
DATEA/A8YYMD = '&YYMD';
DATEB/A4 = DOWK(DATEA, DATEB);
Thanks
WebFOCUS 5.2 upgrading to the latest version at the moment. UNIX HTML
July 19, 2012, 01:23 AM
Waz Can you post more of your code ?
The code you have would be found in a DEFINE, or perhaps a COMPUTE, I have a feeling you need this at a Dialog Manager level.
Waz... Prod: WebFOCUS 7.6.10/8.1.04 Upgrade: WebFOCUS 8.2.07 OS: Linux Outputs: HTML, PDF, Excel, PPT In Focus since 1984 Pity the lost knowledge of an old programmer!
July 19, 2012, 02:28 AM
Sophie Thanks. I added the table file car statement as below. It is now prompting me:
"THE FIELDNAME IS NOT RECOGNIZED: SET "
-*********
-CHECKDAY
-*********
-*
TABLE FILE CAR
PRINT CAR NOPRINT
AND COMPUTE
DATEA/A8YYMD = '&YYMD';
DATEB/A4 = DOWK(DATEA, DATEB);
END
-*
-TYPE DATE OF THE WEEK IS DATEB
-*
-IF DATEB EQ 'SAT' GOTO CHECKAGENT;
-IF DATEB EQ 'SUN' GOTO CHECKAGENT;
-GOTO ENDPROC
Thanks for your help
WebFOCUS 5.2 upgrading to the latest version at the moment. UNIX HTML
July 19, 2012, 08:44 AM
George Patton DOWK takes an I8 parameter for the input. Try this:
DATEA/A8YYMD = '&YYMD';
DATEB/A3 = DOWK(EDIT(DATEA), DATEB); WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
July 19, 2012, 11:17 AM
rfbowley As George pointed out, DOWK requires I8YYMD (or I6YMD) as th input format.
One simple change is required if you need DATEA elsewhere.
DATEA/I8YYMD = &YYMD;
otherwise:
DATEB/A4 = DOWK(&YYMD, DATEB);
Does the job all by itself.
Robert F. Bowley Jr. Owner TaRa Solutions, LLC In WebFOCUS since 2001
July 19, 2012, 12:02 PM
Dan Satchell This can all be done with Dialogue Manager. Maybe this will give you what you want?
-SET &DATEB = DOWK(&YYMD,'A4');
-IF (&DATEB EQ 'SAT' OR 'SUN') GOTO CHECKAGENT;
-GOTO ENDPROC
WebFOCUS 7.7.05
July 19, 2012, 10:17 PM
Sophie Thank you everyone for your response.
It works!
Instead of playing around with my code, I just use Dan's suggestion.
Thanks again
WebFOCUS 5.2 upgrading to the latest version at the moment. UNIX HTML
July 20, 2012, 06:47 AM
George Patton I tried rfbowley's approach and it didn't like
DATEA/I8YYMD = &YYMD;
And DOWK expects a length of A3 according to the documentation, not A4, although the latter wouldn't hurt of course.
WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP