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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
add date function?
 Login/Join
 
Member
posted
Hi,

Anyone know a good function can be used to increment an input date parameter (alpha format, though) by 7 days and use it in where clause? I used the following but get an error message.

WHERE REQUEST_TIME GE DT(&REQUEST_TIME) AND REQUEST_TIME LE DATEADD(DT(&REQUEST_TIME), 'D', 7);

Thanks.

Cecilia


WebFocus server 768
Developer studio 768
Windows XP
Output: Excel, HTML, PDF, AHTML
 
Posts: 7 | Location: New York | Registered: November 06, 2007Report This Post
Virtuoso
posted Hide Post
I've only been able to get things like that to work correctly via DEFINE fields. An example:

DEFINE FILE XYZ
TODAYS_DATE_NORMAL/YYMD = HDATE(TODAYS_DATE, 'YYMD');
SIX_MONTHS_AGO/YYMD = TODAYS_DATE_NORMAL - 182;
END
TABLE FILE XYZ
.
.
.
WHERE EMPLOYMENT_STATUS EQ 'Inactive' AND EFFECTIVE_END_ID GT SIX_MONTHS_AGO
END



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Expert
posted Hide Post
If you are doing the date compare against a relational data source, not all of them will pass a date WHERE screen when the table date is being compared to a DEFINE field. Teradata is one example of an RDBMS where you must specify a data literal as the right-hand side of the compare or the WHERE clause does not get passed to Teradata.

Here is a way, Cecilia, to do this with Dialogue Manager

-* Assume &REQUEST_TIME is the date coming from the launch page.
-SET &ENDDT=AYMD(&REQUEST_TIME,7,'I8YYMD');
TABLE FILE ...
PRINT ...
WHERE REQUEST_TIME GE &REQUEST_TIME AND REQUEST_TIME LE &ENDDT;

Now you didn't mention the format of the table column REQUEST_TIME. That might require an alteration of my code above. The fact that you have the word time in the name makes me think it might be a date-time stamp. Let us know if that is the case.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Member
posted Hide Post
Thank you.

The REQUEST_TIME is a date-time stamp. However, the parameter &REQUEST_TIME is an alpha format. I got an error message when I run your code: (FOC36355) INVALID TYPE OF ARGUMENT #1 FOR USER FUNCTION AYMD

I used DT(&REQUEST_TIME) and still got the same error message...


WebFocus server 768
Developer studio 768
Windows XP
Output: Excel, HTML, PDF, AHTML
 
Posts: 7 | Location: New York | Registered: November 06, 2007Report This Post
Expert
posted Hide Post
First use Dialogue Manager to add 7 days to your date and then use the new variable in your date selection:

-SET &REQUEST_TIME1 =
- DATECVT( DATEADD(DATECVT(&REQUEST_TIME,'I8YYMD','YYMD'),'D', 7),'YYMD','I8YYMD');


The code above looks crazy, but what's happening is you have to convert the alpha string to a Date format using DATECVT, then use DATEADD to add 7 days, then use DATECVT to convert from Date format back to alpha string - read the line of code form inside going outwards.

This of course, assuming that &REQUEST_TIME is an alpha string that contains 8 characters like '20071231'.

Then your WHERE statement should be:

WHERE REQUEST_TIME FROM DT(&REQUEST_TIME 00:00:00.000) TO DT(&REQUEST_TIME1 23:59:59.999); 


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
Thank you all!

It worked.


WebFocus server 768
Developer studio 768
Windows XP
Output: Excel, HTML, PDF, AHTML
 
Posts: 7 | Location: New York | Registered: November 06, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders