Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


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

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[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: 117 | Registered: May 28, 2015Report 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, 2007Report 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: 117 | Registered: May 28, 2015Report 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: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report 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: 117 | Registered: May 28, 2015Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

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-2020 Information Builders