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  WebFOCUS/FOCUS Forum on Focal Point     [solved] comparing date fields

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[solved] comparing date fields
 Login/Join
 
Platinum Member
posted
Hi,
In MFD I have the DEFINES below.

-**********************
DEFINE TODAYS/YYMD='&YYMD';,ACCESS_PROPERTY=(INTERNAL),$
DEFINE TODAYS_30/YYMD=DATEADD(TODAYS,'D',30);,$
DEFINE TYPE_PERIOD/A50V=IF BTYPE EQ 'X' THEN 'X' ELSE IF REQ_DATE LE TODAYS THEN 'PAST_DUE' ELSE IF REQ_DATE LE TODAYS_30 THEN 'BO_30' ELSE 'BO';
TITLE='TYPE_PERIOD', $
-********************

FIELDNAME=REQ_DATE, ALIAS=REQUIRED_DATE, USAGE=YYMD, ACTUAL=DATE, $

-****************************


When I check SQL trace I get the following warnings .
I am not sure what to change so that the it converts to SQL properly and Aggregation gets done.

(FOC2590) AGGREGATION NOT DONE FOR THE FOLLOWING REASON:
(FOC2565) THE OBJECT OF BY/ACROSS CANNOT BE CONVERTED TO SQL
(FOC2566) DEFINE TODAYS_30 CANNOT BE CONVERTED TO SQL
(FOC2576) COMBINATION OF PARAMETERS OF FUNCTION DATEADD CANNOT BE CONVERTED TO SQL

-***
I have to put these DEfine/conditions in my MFD so that the InfoAssist users can simply use these fields.

thanks

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


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
I've never done this, but try using the function DB_EXPR to insert a SQL expression.

Check the manual: WebFOCUS Language Documentation > Using Functions > Data Source and Decoding Functions > DB_EXPR: Inserting an SQL Expression Into a Request.

There's also SQL.

Check the manual: Creating Reports With WebFOCUS Language > Creating Temporary Fields > Defining a Virtual Field > Passing Function Calls Directly to a Relational Engine Using SQL.Function Syntax


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
Master
posted Hide Post
I got TODAYS_30 to work as you see below. I know I am not duplicating your situation exactly, but maybe this will help you solve the problem:

DEFINE FILE IBISAMP/CAR
  TODAYS_30/YYMD=DATEADD('&YYMD','D',30);,$ 
END

TABLE FILE IBISAMP/CAR
SUM
     CAR.BODY.SALES
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR
BY  CAR.CARREC.MODEL
BY  TODAYS_30
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
END


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
Somehow TODAYS and TODAYS_30 are confusing the WebFOCUS engine.

Run this code:

DEFINE FILE IBISAMP/CAR
  TODAYS_30/YYMD=DATEADD('&YYMD','D',30);,$ 
END

TABLE FILE IBISAMP/CAR
SUM
     CAR.BODY.SALES
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR
BY  CAR.CARREC.MODEL
BY  TODAYS
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
END

There is no TODAYS defined, but when I use TODAYS in a BY statement, the report runs but TODAYS_30 shows up on the report instead of TODAYS.

Also, if you try to define both a TODAYS and a TODAYS_30, it will cause an error.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
Doh!

Remove the comma/dollar signs in the DEFINE and all is well.

DEFINE FILE IBISAMP/CAR
  TODAYS/YYMD='&YYMD';
  TODAYS_30/YYMD=DATEADD('&YYMD','D',30);
END

TABLE FILE IBISAMP/CAR
SUM
     CAR.BODY.SALES
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR
BY  CAR.CARREC.MODEL
BY  TODAYS
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
END

This is not a master file, I guess.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Platinum Member
posted Hide Post
thanks All..DB_EXPR did the trick


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report 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] comparing date fields

Copyright © 1996-2020 Information Builders