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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


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

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[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, 2009Report 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: 1948 | Location: New York | Registered: November 16, 2004Report 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, 2009Report 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)


N/A
 
Posts: 397 | Location: New York City | Registered: May 03, 2007Report 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, 2009Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

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

Copyright © 1996-2020 Information Builders