Focal Point
DATES

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8471085252

October 18, 2007, 05:13 PM
<Umar Farook S>
DATES
Hi I need to select data between 2 dates.

DEFINE FILE MUREX
RUNDATE/MDY = &MDY;
DATE/I6YMD = RUNDATE;
BEFORE30DAYS/I6YMD = AYMD(DATE, -30, BEFORE30DAYS);
NEW_TRADE/I6YMD = TRADE_DATE;
END
-*
TABLE FILE MUREX
PRINT
ASSET_ID
SWAPID
STRADID
ASSET_TYPE
ASSET_SUB_TYPE
COUNTERPARTY_LONG_NAME
LEGAL_ENTITY_LONG_NAME
PORTFOLIO
TRADE_DATE
TRADE_TYPE
NOTIONAL_AMOUNT
TRADER_COMMENT
CONFIRMATION_COMMENT
WHERE NEW_TRADE GT BEFORE30DAYS AND TRADE_DATE LT DATE
BY SWAPID NOPRINT
ON TABLE HOLD AS MUREX1 FORMAT FOCUS INDEX SWAPID STRADID PORTFOLIO
END
-*
-EXIT

But i am unable to execute this code i get an error like
0 ERROR AT OR NEAR LINE 235 IN PROCEDURE MEMFEX FOCEXEC *
(FOC178) THE ADDITION OF TWO OR MORE DATE FIELDS IS INVALID
(FOC009) INCOMPLETE REQUEST STATEMENT

Please help me out on this.
October 18, 2007, 05:19 PM
Prarie
Try splitting your Where statment into two separate Where statments...


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
quote:
WHERE NEW_TRADE

How is NEW_TRADE defined as a date? If it is a smart date then make RUNDATE mdyy and just create BEFORE30DAYS as mdyy which is RUNDATE - 30.

If NEW_TRADE is MDYY then should work, but if it is say yymd, then make your dates yymd.

Of course it might be you just need parenthesis in your where statement

WHERE (NEW_TRADE GT BEFORE30DAYS) AND (TRADE_DATE LT DATE);


Leah
Another thing you might want to do is do your date targets in Dialog Manager. The technique you are using is fine (once you get it to work). However, you wind up recalculating your from and to dates for every row in your input file. That is one inefficiency.

Another is comparing your database fields to a defined field. If you input file is flat or FOCUS, it is no big deal. But if you do that against a relational data source, the WHERE will not be passed to the database and you will get many more rows back that WebFOCUS will have to process. In this case, using the Dialog Manager variables will make those WHERE tests against literals and the WHERE will be passed to the backend.


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