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     DEFAULT and MRNOEDIT INCLUDE issue (not sure which)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
DEFAULT and MRNOEDIT INCLUDE issue (not sure which)
 Login/Join
 
Master
posted
I'm trying to create a common include file that can be -INCLUDEd by my report writers as an easy way to make sure end users do not run a report for too many days.

When I run the INCLUDE by itself, everything seems to work fine. When I run it as an include, it has errors.

I'm sure this is something simple.

Calling Program:
-PROMPT &BEG1.A8.Enter Start Date (YYYYMMDD):.;
-PROMPT &END1.A8.Enter End Date (YYYYMMDD):.;

-MRNOEDIT -INCLUDE DATECHEK

-TYPE FURTHER PROCESSING TO OCCUR BELOW!


Datecheck.fex
-* Set Defaults
-DEFAULTH &MAXRUNDAYS  = '31';

-DEFAULTH &ENDYYYYMMDD = '0';
-DEFAULTH &ENDMMDDYYYY = '0';
-DEFAULTH &ENDDATE     = '0';
-DEFAULTH &END1        = '0';
-DEFAULTH &TODATE      = '0';


-DEFAULTH &BEGYYYYMMDD = '0';
-DEFAULTH &BEGMMDDYYYY = '0';
-DEFAULTH &BEGDATE     = '0';
-DEFAULTH &BEG1        = '0';
-DEFAULTH &FROMDATE    = '0';
-* Set Defaults
-RUN


-***********************************************************************
-* Determine which date var names are used and assign properly.
-***********************************************************************

-* End Dates

-IF &ENDYYYYMMDD GT '0' THEN GOTO DOEYYMD111 ELSE IF &ENDMMDDYYYY GT '0' THEN GOTO DOEMDYY111 ELSE IF &TODATE GT '0' THEN GOTO DOTO111 ELSE IF &ENDDATE GT '0' THEN GOTO DOENDD111 ELSE GOTO DOEND1111;

-DOEYYMD111
-SET &TODATE = '&ENDYYYYMMDD.EVAL';
-GOTO DOEEND111


-DOTO111
-SET &TODATE = '&TODATE.EVAL';
-GOTO DOEEND111


-DOEMDYY111
-SET &TODATE = '&ENDMMDDYYYY.EVAL';
-GOTO DOEEND111


-DOENDD111
-SET &TODATE = '&ENDDATE.EVAL';
-GOTO DOEEND111


-DOEND1111
-SET &TODATE = '&END1.EVAL';
-GOTO DOEEND111


-DOEEND111



-* Start Dates

-IF &BEGYYYYMMDD GT '0' THEN GOTO DOBYYMD111 ELSE IF &BEGMMDDYYYY GT '0' THEN GOTO DOBMDYY111 ELSE IF &FROMDATE GT '0' THEN GOTO DOFROM111 ELSE IF &BEGDATE GT '0' THEN GOTO DOBEG111 ELSE GOTO DOBEG1111;

-DOBYYMD111
-SET &FROMDATE = '&BEGYYYYMMDD.EVAL';
-GOTO DOBEND111


-DOFROM111
-SET &FROMDATE = '&FROMDATE.EVAL';
-GOTO DOEEND111


-DOBMDYY111
-SET &FROMDATE = '&BEGMMDDYYYY.EVAL';
-GOTO DOBEND111


-DOBEGD111
-SET &FROMDATE = '&BEGDATE.EVAL';
-GOTO DOBEND111


-DOBEG1111
-SET &FROMDATE = '&BEG1.EVAL';
-GOTO DOBEND111


-DOBEND111


-*-TYPE &|FROMDATE    = &FROMDATE
-*-TYPE &|TODATE      = &TODATE


-***********************************************************************
-* Calculate the days to be run
-***********************************************************************

-SET &FROMDATE  = DATECVT(&FROMDATE, 'I8YYMD', 'YYMD');
-SET &TODATE    = DATECVT(&TODATE, 'I8YYMD', 'YYMD');
-SET &DAYSTORUN = DATEDIF(&FROMDATE,&TODATE,'D') + 1;

-*-TYPE &|DAYSTORUN   = &DAYSTORUN





-***********************************************************************
-* Throw an error if requested days > &MAXRUNDAYS
-***********************************************************************

-IF &DAYSTORUN LT &MAXRUNDAYS THEN GOTO DOPCD111 ELSE GOTO DOERR111;

-DOERR111
-HTMLFORM BEGIN

<HTML>
<BODY>
<h1>Error:  Max Days Exceeded</h1>
</BODY>
</HTML>

-HTMLFORM END
-EXIT



-DOPCD111
-* Do Nothing, Fall Through
-*-TYPE Resume Processing



If the date range provided is greater than 31 days, the HTML message will be displayed and execution halted. If not, you will see the 'FURTHER PROCESSING TO OCCUR BELOW!' message.

Specifically, the issue is that I can either have all the dates prompted (with DEFAULT) or NONE of the dates prompted (DEFAULTH).

- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Virtuoso
posted Hide Post
1.
quote:
When I run it as an include, it has errors.

Namely?


2. I don't see why you needs all the goto's and labels in the first 2 blocks of code (nor the .evals). Wouldn't a -SET like this do it?
-SET &TODATE =
-      IF &ENDYYYYMMDD GT '0' THEN &ENDYYYYMMDD
- ELSE IF &ENDMMDDYYYY GT '0' THEN &ENDMMDDYYYY 
- ELSE IF &TODATE      GT '0' THEN &ENDMMDDYYYY 
 etc. etc.
- ELSE '0';
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Master
posted Hide Post
quote:
1.
quote:
When I run it as an include, it has errors.

Namely?


Well, unintended results as specified in the initial post. (Prompt for all amper vars or none).

quote:

2. I don't see why you needs all the goto's and labels in the first 2 blocks of code (nor the .evals). Wouldn't a -SET like this do it?
-SET &TODATE =
-      IF &ENDYYYYMMDD GT '0' THEN &ENDYYYYMMDD
- ELSE IF &ENDMMDDYYYY GT '0' THEN &ENDMMDDYYYY 
- ELSE IF &TODATE      GT '0' THEN &ENDMMDDYYYY 
 etc. etc.
- ELSE '0';


Maybe I took and implemented your example too literally. I failed on the first unset variable.

-SET &BEGYYYYMMDD     = '20101001';
-SET &ENDYYYYMMDD     = '20101031';

-SET &DATEEND =
-      IF &ENDYYYYMMDD EQ FOC_NONE THEN '&ENDYYYYMMDD'
- ELSE IF &ENDMMDDYYYY EQ FOC_NONE THEN '&ENDMMDDYYYY'
- ELSE IF &ENDDATE     EQ FOC_NONE THEN '&ENDDATE'
- ELSE IF &END1        EQ FOC_NONE THEN '&END1'
- ELSE IF &TODATE      EQ FOC_NONE THEN '&TODATE'
- ELSE '0';

-TYPE &|DATEEND   = &DATEEND
-EXIT


Here, it fails when trying to read &ENDMMDDYYYY. What I didn't call out more specifically what that my shop thousands of programs and the 5 start date and 5 end date variables are the most popular variable names used in our prompts. I am trying to accommodate for the code as it exists by 'sniffing' the variable name used and substituting its value in for a generic one. It would be very easy for me to draw a line and say 'if you want to use this include, change your date prompts to be _____ and ____, otherwise it will not work.'. I'd rather do this dynamically.

- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Virtuoso
posted Hide Post
Either way (your compound -IF ... GOTO ... ELSE ...; or my -SET ... IF ... ELSE ...) requires that all the referenced amper variables exist prior to the first reference to their value. Since you reference a slew of variables, your routine needs to declare them all in a -DEFAULT statement at the top, so that they exist. Otherwise you will either get a pre-execution autoprompt or an execution-time error.

Note that the -DEFAULT in your -INCLUDE routine will override an inherited "-DEFAULT" value of the same variable, but will leave a "-SET" value untouched, so your routine will preserve any values acquired via explicit -SET (or EX parameters, autoprompt, or launch-page controls, which are equivalent to -SET).


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 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     DEFAULT and MRNOEDIT INCLUDE issue (not sure which)

Copyright © 1996-2020 Information Builders