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] Using Parameter in a Define - Darn FOC_NULL

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Using Parameter in a Define - Darn FOC_NULL
 Login/Join
 
Member
posted
I am trying to create a virtual field with DEFINE that uses the selection of a parameter in its logic. When a value like 'CANCELED' is selected it works great, but when "ALL" (foc_null) is selected the DEFINE field seems to not get created.

I've tried variations of the logic with and without quotes around the parameter but nothing seems to work properly for both selected values and "ALL" cases.

  

DEFINE FILE CLUBMEMBERS

BypassDate/MDYY=
	IF ( &CLUBSWITCHTYPEFILTER EQ '_FOC_NULL' )  THEN '01/01/1920' ELSE
	IF ( &CLUBSWITCHTYPEFILTER EQ 'CANCELED' )   THEN '&CLUBMEMBERDATEFROM' ELSE '01/01/1920';

END

TABLE FILE CLUBMEMBERS
PRINT
BypassDate



0 ERROR AT OR NEAR LINE 95 IN PROCEDURE club_member_movement_report_fex_v1FOCEXEC * (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: _FOC_NULL 0 ERROR AT OR NEAR LINE 120 IN PROCEDURE club_member_movement_report_fex_v1 (FOC003) THE FIELDNAME IS NOT RECOGNIZED: BypassDate BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT


Any ideas?

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


WebFOCUS Version: 7703
Windows, all output
 
Posts: 16 | Registered: August 18, 2011Report This Post
Expert
posted Hide Post
Try determining the Bypass Date in Dialogue Manager, then use it in the DEFINE. The FOCNULL is active in the DEFINE (preventing the line of code from being parsed) but will not be in Dialogue Manager.

-SET &BYPASSDATE = 
-  IF ( &CLUBSWITCHTYPEFILTER EQ '_FOC_NULL' ) THEN '01/01/1920' ELSE
-  IF ( &CLUBSWITCHTYPEFILTER EQ 'CANCELED' )  THEN &CLUBMEMBERDATEFROM ELSE '01/01/1920';


DEFINE FILE CLUBMEMBERS
BypassDate/MDYY = &BYPASSDATE;
END

By the way, you may need to use the WITH attribute for the defined field...
DEFINE FILE CLUBMEMBERS
BypassDate/MDYY WITH real-field = &BYPASSDATE;
END


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
Expert
posted Hide Post
You will be better off using COMPUTE instead of DEFINE:

TABLE FILE CLUBMEMBERS
PRINT
COMPUTE BypassDate/MDYY = &BYPASSDATE;
...
END


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 for the post. I believe a COMPUTE will not work for me in that I need to use this is a WHERE clause.

I am trying the following:


-SET &BYPASSDATE = 
-  IF ( &CLUBSWITCHTYPEFILTER EQ '_FOC_NULL' ) THEN '01/01/1920' ELSE
-  IF ( &CLUBSWITCHTYPEFILTER EQ 'CANCELED' )  THEN &CLUBMEMBERDATEFROM ELSE '01/01/1920';

DEFINE FILE CLUBMEMBERS
BypassDate/MDYY = &BYPASSDATE;
 
TABLE FILE CLUBMEMBERS
PRINT BypassDate



and while syntax is good, it appears all results for the defined BypassDate are blank, and not the value just set.


WebFOCUS Version: 7703
Windows, all output
 
Posts: 16 | Registered: August 18, 2011Report This Post
Expert
posted Hide Post
Perhaps because
BypassDate/MDYY = &BYPASSDATE;
is incorrect. It should be
BypassDate/MDYY = '&BYPASSDATE';
I didn't plan on debugging all the posted code.

Also, a DEFINE is wrong if you "need to use this in a WHERE clause". The WHERE clause should use the Dialogue Manager variable. Try
WHERE TEST_DATE GT '&BYPASSDATE';
Of course, the code may not simply be something like this, because, depending on the data source, you may need to use a function, like this:
WHERE DUEDATE FROM DT(&DTTM_FROM) TO DT(&DTTM_TO);
, or convert the / to - or make the date an integer or

I wouldn't create a constant DEFINE field that will only be used in a WHERE clause. With DEFINE, you're creating the field for every row in the input table, which may be inefficient.


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
Thanks again, and just to close the loop, here's the final (edited) version of what worked. Essentially this 'hack' allowed the report to bypass a "From Date" parameter on specific filter selections.

 

...
SET ALL = PASS

-SET &BYPASSDATE = 
-  IF ( &CLUBSWITCHTYPEFILTER EQ '_FOC_NULL' )     THEN '01/01/1900' ELSE
-  IF ( &CLUBSWITCHTYPEFILTER EQ '''ON HOLD''' )   THEN '01/01/1900' ELSE &CLUBMEMBERDATEFROM;

DEFINE FILE CLUBMEMBERS
BypassDate/MDYY = '&BYPASSDATE';

END

TABLE FILE CLUBMEMBERS
PRINT 
     ...
	 
WHERE CLUBMEMBERS.CLUBMEMBERS.DATEADDED GE '&BYPASSDATE';
...


 


WebFOCUS Version: 7703
Windows, all output
 
Posts: 16 | Registered: August 18, 2011Report This Post
Expert
posted Hide Post
Paul,

It's not really a hack, just, unfortunately, one of the only ways to deal with _FOC_NULL.

By the way, do you really need the DEFINE. It can be a COMPUTE if you need it in the report.


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
Well since you're dealing with DM and DM-parameters. You should DM handle it. Not Focus.



-IF &CLUBSWITCHTYPEFILTER EQ _FOC_NULL THEN L_FOCNULL ELSE CONTINUE;
-IF '&CLUBSWITCHTYPEFILTER' EQ 'CANCELED' THEN L_CANCELED ELSE CONTINUE;

-*
-*  Do your define here for default situation.
-*
-GOTO L_END

-L_FOCNULL
-*
-*  Do your define here for '_FOC_NULL' situation.
-*
-GOTO L_END

-L_CANCELED
-*
-*  Do your define here for 'CANCELED' situation.
-*
-GOTO L_END

-L_END


G'luck


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Guru
posted Hide Post
All you needed to really do was to put quotes around &CLUBSWITCHTYPEFILTER and you could have kept your define without dialogue manager.

Without quotes, the literal value is inserted rather than the variable.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Expert
posted Hide Post
Perhaps, but creating a DEFINE field for filtering is not efficient.


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
  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] Using Parameter in a Define - Darn FOC_NULL

Copyright © 1996-2020 Information Builders