Focal Point
[SOLVED] Day of the Week is acting funny. Possible glitch?

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

December 21, 2010, 06:33 PM
jjeanjaquet
[SOLVED] Day of the Week is acting funny. Possible glitch?
I am witness to an interesting problem that I can't figure out. The boss upstairs wanted the day of the week in addition to the date. I created a define field in the master file to take the DOWK(DATE,'A3'), and I inserted the field as a "BY" in the Report Painter. When I ran the report, the correct output from November 1 - Nov 15 is displayed (Sun, Mon, Tue, etc.), but from every date from then on, the field is empty.
It makes no sense, so I was wondering if anyone had encountered this error, and more importantly, if anyone knows what the problem might be.

Thanks

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


WebFOCUS 7.7.2: Windows 7: all output (Excel, HTML, PDF)
December 21, 2010, 08:57 PM
Waz
What format is the DATE field ?

DOWK requires a date in I6YMD or I8YYMD format.


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!

December 22, 2010, 03:13 AM
Tony A
All OK in 7.7.01 using the following code. Test it on your 7.7.02 set-up and if you have any problems then I would recommend giving IB support a call.

EX -LINES 3 EDAPUT MASTER,DATERNG,CF,MEM,FILENAME=DATERNG, SUFFIX=FOC,$
SEGNAME=SEG1
FIELD=DATE_KEY, ,DMYY ,DMYY , $
-RUN
-* Now create it
CREATE FILE DATERNG
-* and add all possible dates within a month
MODIFY FILE DATERNG
FREEFORM DATE_KEY.A8.
LOG FORMAT MSG OFF
LOG TRANS MSG OFF
LOG INVALID MSG OFF
DATA
-* This repeat loop will ensure at least a whole month is input,
-* Any invalid dates will be rejected.
-DEFAULT &Year  = 2010
-SET &Year  = EDIT(&YYMD,'9999$');
-SET &Mnth = 11;
-SET &Day   = 1;
-REPEAT :Loop1 31 TIMES;
-SET &Date = IF &Day LT 10 THEN '0' || &Day ELSE &Day;
&Date&Mnth&Year
-SET &Day = &Day + 1;
-:Loop1
END
-RUN
-*
DEFINE FILE DATERNG
  KEY_YYMD/I8YYMD = DATE_KEY;
  DOW/A3          = DOWK(KEY_YYMD,'A3');
END
-*
TABLE FILE DATERNG
PRINT DOW
   BY DATE_KEY
ON TABLE SET PAGE NOLEAD
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
  GRID=OFF, SIZE=10, $
ENDSTYLE
END

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 22, 2010, 10:08 AM
Kerry
Thanks Waz and Tony for the input.

jjeanjaquet, suggestion from our technicals:

If the date field is a smart date field then you can take advantage of the date formatting of W for day of the week.
Here is an example:

DEFINE FILE EMPDATA
HIREDATEDOW/Wt=HIREDATE;
END
TABLE FILE EMPDATA
SUM CNT.PIN
BY HIREDATEDOW
END


Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
December 22, 2010, 03:51 PM
jjeanjaquet
Thanks everbody. I did what Kerry suggested and used the date format "Wt" instead of creating an expression using DOWK() and that seems to have done the trick.

Much appreciated,

Joe


WebFOCUS 7.7.2: Windows 7: all output (Excel, HTML, PDF)
December 22, 2010, 04:45 PM
Waz
At least we now know it was a Smart Date field.

Many options available.


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!