Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Day of week from SQL Server Date field
Go
New
Search
Notify
Tools
Reply
  
[SOLVED]Day of week from SQL Server Date field
 Login/Join
 
Platinum Member
posted
I have a SQL server table that has a date field in it called LOADDATE. In the description of the column in SQL Server it says LOADDATE (date, not null)

When I have a DEFINE using the DOWK(LOADDATE, 'A4') I get blanks returned.
When I just report out the LOADDATE field I get 2016/08/29
When I substitute &YYMD in DOWK(&YYMD, 'A4') then MON is returned as it should be.
When I report out &YYMD by itself I get the date in the 2016/08/29 format.

So why if the two fields have the same format does the DOWK(LOADDATE, 'A4') not work?

Thanks Trudy

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


WF8
Windows
 
Posts: 111 | Registered: May 28, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
DOWK expects the date in legacy I8YYMD format (like &YYMD). Your LOADDATE will be defined as a SmartDate in the FOCUS synonym. Try this to print the day of week for a SmartDate:

TABLE FILE xxxx
PRINT LOADDATE/WT
.
.
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
The PRINT LOADDATE/WT did give me the day of the week but I want to filter on that value so I was looking more for a DEFINE way of getting to the day of week. Sorry I should have made that clearer in the original post.


WF8
Windows
 
Posts: 111 | Registered: May 28, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
You could probably save yourself some trouble and use a SQL Server function

DEFINE FILE xxxx
 DOW/A10  WITH yyyy = DB_EXPR( DATENAME( dw,  START_DATE ) ); $ 
END  


It will be the full weekname in mixed case, but you can probably work with that. And there is no fear that it will not be translated.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1100 | Location: Toronto, Ontario | Registered: May 26, 2004Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Got what I needed by creating a define with the following
  
DOWK(DATECVT(LOADDATE, 'YYMD', 'I8YYMD'), 'A4')


Thanks for all the help!


WF8
Windows
 
Posts: 111 | Registered: May 28, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Day of week from SQL Server Date field

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.