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  iWay Software Product Forum on Focal Point    [SOLVED] Current Date Minus x DAYS
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Current Date Minus x DAYS
 Login/Join
 
Gold member
posted
I have a very basic SQL statement that I am trying to run via DMC.

SELECT T1.DATE_STAMP FROM DATE_DIM T1 WHERE (T1.DATE_STAMP >= Current Date - 5 Days)

This query is connecting to a DB2/400 database and works from every desktop query tool I have but errors in DMC which is ultimately where I need this to run. The DATE_STAMP column in the statement above is setup as a DATE datatype in my synonym.

Is there a reason in particular that DMC can't seem to translate this basic query? I have seen some work arounds via DEFINES that folks have mentioned on the WebFOCUS side of the house but can't seem to find any good solutions in DMC.

Any thoughts on alternative ways to achieve this result would be appreciated.

Thanks,
Bob

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


WebFOCUS 7.6.8
WebFOCUS Client and Server running on RedHat Linux, Developer Studio on Windows XP
All output formats
 
Posts: 52 | Registered: May 13, 2009Reply With QuoteReport This Post
Expert
posted Hide Post
Hi Bob,

Do you run this using SQL Pass-Thru? If so, try adding SQL DB2 to the top of the request. Here is a simple focexec to start with:

SQL DB2
SELECT T1.DATE_STAMP FROM DATE_DIM T1 WHERE (T1.DATE_STAMP >= Current Date - 5 Days);
END

TABLE FILE SQLOUT
PRINT *
END


Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
 
Posts: 1950 | Location: New York | Registered: November 16, 2004Reply With QuoteReport This Post
Member
posted Hide Post
Hi,

1) Is using DBMS SQL flow OK? In that case it allows you to enter dialect-specific SQL statements. So no translation will be done by adapter - SQL Pass-Thru query.

2) From the iWay DataMigrator Functions Reference you can find function called CURRENT_DATE.

For example:
WHERE T1.DATE_STAMP >= CURRENT_DATE - 5

Link to reference: http://documentation.informati...ions76/sql_date2.htm

3) Create a stored procedure which will make the date calculation.
For example:
-SET &&NDATE=AYMD(&YYMD, -5,'I8');

Then create data flow and from the SQL object, add filter like that:
T1.DATE_STAMP >= '&&NDATE'

From the same data flow, open the process flow tab. Delete the connection between Start object and Data Flow. Add there previously created stored procedure and create connections again - in order: Start object--Stored procedure--Data Flow.


Regards,
Rivo


iSM 6.0
iDM 7.6.5 - 7702
WF 7.6.4 - 7702

All output formats
 
Posts: 23 | Location: Tallinn, Estonia | Registered: July 31, 2009Reply With QuoteReport This Post
Guru
posted Hide Post
If you don't want to use a DBMS SQL Flow you can create a normal Data Flow with a filter using the DAYS function like this.

SELECT T1.DATE_STAMP FROM DATE_DIM T1 WHERE ( DAYS(T1.DATE_STAMP) >= DAYS(CURRENT_DATE) - 5)
 
Posts: 389 | Location: New York City | Registered: May 03, 2007Reply With QuoteReport This Post
Gold member
posted Hide Post
Clif,

Your suggestion seems to actually work better then the SQL passthru. Thanks for the suggestion.

Bob


WebFOCUS 7.6.8
WebFOCUS Client and Server running on RedHat Linux, Developer Studio on Windows XP
All output formats
 
Posts: 52 | Registered: May 13, 2009Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [SOLVED] Current Date Minus x DAYS

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