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.
If I run the following piece of code I get 1 then 2 as a result for the value contained within CR.
5 line code snippet
-DEFAULTS CR=1
-TYPE &CR
-DEFAULTS CR=2
-TYPE &CR
I was always taught that if a value had been assigned to a variable then a -DEFAULTS would be ignored.
Clearly it has been assigned by the first -DEFAULT rather than a -SET command, but I am investigating a saved parameter report that does not work properly and the mechanism of a saved parameter report is to create a dummy fex with the values saved in -DEFAULT statements with the .fex you are saving the parameters for as a -INCLUDE. If the -INCLUDE contains defaults itself then this will override early defaults.
Could users with version of wf other than mine 762 please test this 5 line code snippet and report back to see if this is a version specific bug.This message has been edited. Last edited by: hammo1j,
Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2 Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006
-IF &TITLE.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &TITLE=R1376 Emergent & Additional VO Work;
-IF &REPORT.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &REPORT=4;
-IF &CR.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &CR=12489;
-IF &CRTYPE.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &CRTYPE=Activity;
-IF &LABOUR_DATE.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_DATE=TODAY;
-IF &LABOUR_OVERHEAD.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_OVERHEAD=0;
-IF &CONTRACT.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &CONTRACT=7.29;
-IF &LABOUR_WARRANTY_PERCENT.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_WARRANTY_PERCENT=0.00;
-IF &LABOUR_FLAT_RATE.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_FLAT_RATE=31.96;
-IF &CONMAN.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &CONMAN=Adrian Michie: BVT Contracts Manager;
-IF &CONTYPE.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &CONTYPE=M O D;
-IF &RFS_DATE.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &RFS_DATE=17/10/2008;
-IF &DAYS.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &DAYS=0;
-IF &LABOUR_General_Engineering.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_General_Engineering=0.00;
-IF &LABOUR_Logistics.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_Logistics=0.00;
-IF &LABOUR_Proj_Mgmt.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_Proj_Mgmt=0.00;
-IF &LABOUR_RN.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_RN=0.00;
-IF &LABOUR_Technical_Services.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_Technical_Services=0.00;
-IF &LABOUR_Waterfront.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &LABOUR_Waterfront=0.00;
-IF &ZEROPRICE.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &ZEROPRICE=No;
-IF &VIC_COMP_DATE.EXIST EQ 1 THEN GOTO INCFEX;
-DEFAULTS &VIC_COMP_DATE=TBC;
-INCFEX
-INCLUDE app/r1376_emergent_and_additional_vo_work.fex
If the first defined defaults does not take precedence then how can the saved parameter report be guaranteed to work if, for example, R1376 has a defaults statement of its own.
btw the fact that the proc is -INCLUDED makes no difference.
ie if you have
-*proc 1 -DEFAULTS CR=1 -TYPE &CR -INCLUDE PROC2
-* proc 2 -DEFAULTS CR=2 -TYPE &CR
still gives you 1 followed by 2.
Does anyone else have problems with saved parameter reports?
Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2 Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006
-DEFAULT &&FOO=ONE
CURRENTLY DEFINED & VARIABLES STARTING WITH '&FOO':
&&FOO = ONE
-? &&FOO
-RUN
-DEFAULT &&FOO=TWO
CURRENTLY DEFINED & VARIABLES STARTING WITH '&FOO':
&&FOO = TWO
-? &&FOO
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
Are you responding definitively on behalf of a known IBI undocumented feature or on the basis of your experience.
What you are saying would suggest that the saved parameter screens will NEVER work on its own (unless the procedure has no defaults), but only if you use it as a template in the amend saved values option.
Certainly during amper autoprompting with -DEFAULTS gives the opposite result in that it is the FIRST amper variable encountered whose value is taken and displayed in the text box.
Remember, the saved parameter logic is not there to provide actual default values for the parameter, it is only there for the autoprompt feature. This thing only reads the procedure, does not execute it, nor follows the logic. And that way it finds the latest used values (the -defaults) for the used parameters. So forget whatever is in the saved parameter logic, it is not meant to be executed at all.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
It is also interesting to see that the documented syntax is -DEFAULT (without the S) or at least in the DS help files it is. Having been bitten on using undocumented "loop holes" when code tightening is introduced, I would advise against using -DEFAULTS and change your existing fexes to have -DEFAULT instead.
On the subject of -DEFAULT and to quote the DS help files (again) -
quote:
You can override values set with -DEFAULT by supplying new values when you call the WebFOCUS scripts, or by issuing -SET after -DEFAULT.
In the case of a single fex (e.g. not calling it and supplying values), this seems a little ambiguous as it could read either way - i.e. a DEFAULT value only gets overriden by using -SET or a subsequent reassignment (either -SET or -DEFAULT) will cause the fex to replace the previous value (unless a -DEFAULT follows a -SET where it will retain the value from -SET obviously).
I've always understood it to be the latter explanation, that in the case of no -SET, the value used is the last -DEFAULT value issued before a -RUN.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
In the Systems Journal article to which I referred, Greg Dorman explained (inter alia) how -RUN operates. As I recall, it went as follows:
When the interpretation of a Focexec resumes at the line following -RUN, it is a fresh execution of the program. To allow for this, -RUN saves the state (before handing over control for execution of the stacked FOCUS commands), and the new execution re-establish the state based on that information. The state information is (or was back then) appended to FOCSTACK. (You could see that by setting FOCSTACK=0, forcing the entire content of FOCSTACK into a disk file.) For each amper variable, the saved information includes the var's name, length, value, and state (meaning whether it was established by -SET, or only by -DEFAULT).
I don't think the article explicitly covered what happens when a second -DEFAULT is encounted for the same variable -- but if you think about it, if the first -DEFAULT wins it would be irrelevent whether a previous value was established via -DEFAULT or -SET. So the inclusion of that bit of state info in the save and restore reflects the behavior of 'last -Default wins' that we see in the Focus and WebFocus products today.
I would not consider that article to be binding documentation of product behavior, and I am not aware that this particular aspect of Dialog Manager behavior (last DEFAULT wins, absent SET) appears in any 'ex cathedra' documentation. But operation of untold applications (undoubtably including some provided by IBI) would be sideswiped by deviation from that model, so I cannot see IBI changing it.
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
Originally posted by Waz: . . . the issue of -DEFAULT not working for -INCLUDE more than 2 levels down.
I haven't come across that. Do you mean a var established by a -DEFAULT appearing earlier in the outermost fex of the nest is invisible to the innermost -- or one established by a -DEFAULT in the inner is lost when control returns to the outer?
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
What I see there is a statement that a second -DEFAULT value (which happens to reside in the Included file) overrides the first; nothing new there, other than confirmation of the behavior we have observed.
I'm still puzzled -- what is "not working for -INCLUDE more than 2 levels down" -- can you provide an example?
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
Jack, The issue I have, is exactly what was in the Symptom/Problem/Solution, I only experiences it with the second level include. i.e. -INCLUDE in a -INCLUDE in an EX.
To solve the problem with -DEFAULT in the -INCLUDE file I did away with the -DEFAULT and used the code above.
If &FOO was set as an incoming parameter, the parameter value acts like a -SET, so the -DEFAULT is ignored; and the -SET leaves the parameter value intact.
If no '-SET' (or equivalent) has yet occured, the outer fex's default will create the variable with a tentative value, and then the -SET will promote the default value, immunizing it from subsequent defaults.
That's what the Symptom/Solution page meant by "use -SET".
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
Remember, the saved parameter logic is not there to provide actual default values for the parameter, it is only there for the autoprompt feature. This thing only reads the procedure, does not execute it, nor follows the logic. And that way it finds the latest used values (the -defaults) for the used parameters. So forget whatever is in the saved parameter logic, it is not meant to be executed at all.
If you follow this example you will see that the saved parameter code does get executed as a normal focexec.
Create this in MRE
-* test.fex
-DEFAULTS CR=1
-TYPE &CR
From within the BID Dashboard/Reporting Portal...
1. Run test - it will amper autoprompt and enter the value 2 and then run the report and it will correctly display 2.
2. Now save the parameter as CR2 test. Here is the fex created.
3. Now locate the saved parameter report in tree - My Reports - Saved Parameter Reports
Double click this to run directly and you will avoid being amper auto prompted and the value displayed will be the wrong answer of 1.
OR
Right click and select Run and you get the same result.
4. If you right click and selct 'Edit Parameters', this time you are auto prompted and the report thus will have the correct value.
It seems from this example that the designer of saved parameter reports realised that in autoprompting that first defined wins and he assumed that in the execution phase the same rules applied but as we have confirmed it is last wins out!
What the designer of Saved Parameter reports should have coded as suggested by J.Gross et al is this.
Jack, that may be true for fex's that set the environment, but my includes are called from many places and the variables may have been -SET or -DETAULTed or not at all.
The code I posted seems to handle all cases.
John, this is not an issue for me, just posting some code that may help someone.
Both approaches have their place, when supplying a -DEFAULT value in a fex that may get invoked (as parent or child or both) in an -INCLUDE structure, where you are not in charge of the other (including or included) fexes. It depends on the objectives.
(I've homogenized the names for ease of comparison.)
If you want to immunize your default from any later defaults, simply adding a "-SET to itself" does the trick (without need for a second amper var or a label and goto).
-DEFAULT &var=value
-SET &var=&var;
If you want to preserve any default value already acquired, you need something more complex
-- either avoid executing it when the var already has a value: