Focal Point
[Case Opened/Closed] -DEFAULTH in a -INCLUDE overrides parents -DEFAULTH

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

November 11, 2015, 04:52 PM
Waz
[Case Opened/Closed] -DEFAULTH in a -INCLUDE overrides parents -DEFAULTH
Has anyone experienced this ?

Mains fex has a -DEFAULTH for a varible, -INCLUDEd fex also has a -DEFAULTH.

The included fex's -DEFAULTH overrides the main fex.

e.g.

Main fex
-DEFAULTH &TEST = 'Main' ;
-TYPE &|TEST = &TEST
-INCLUDE INCLUDED_FEX
-TYPE &|TEST = &TEST


-DEFAULTH &TEST = 'Include' ;

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


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

November 11, 2015, 06:03 PM
CoolGuy
What are you using? Your 7.6.10 or 8.1.04 (per your signature)?

I'm on 8.1.05 and have tried the following code for the main fex:

-DEFAULTH &TEST = 'Main';
-TYPE &|TEST = &TEST
-*-SET &TEST = 'Main';
-INCLUDE IBFS:/WFC/Repository/domainName/subFolder/Included.fex
-TYPE &|TEST = &TEST


And this code for the -INCLUDEd fex:

-DEFAULTH &TEST = 'Include';


If I keep the code without -SETting &TEST like you have it, I get this output:

&TEST = Main
&TEST = Include


But if I -SET it, then I get this output:

&TEST = Main
&TEST = Main


Not sure why the initial default value is not being used from the main fex. You think it would take it. Anyone else?

UPDATE: Wait a minute... So, we've got to think about this one. We are -INCLUDEing the second fex INTO the first one. Thus the 2nd -DEFAULT will override the first due to being considered apart of the main fex (like having a 2nd -SET override a first -SET). So with including the included fex, there is technically only 1 fex at run time. That is why your desired scenario will not work. Am I thinking this out correctly?

Tried this all in one fex and I get the first results/output described above:
-DEFAULTH &TEST = 'Main';
-TYPE &|TEST = &TEST
-DEFAULTH &TEST = 'Included';
-TYPE &|TEST = &TEST

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


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
November 11, 2015, 06:22 PM
Waz
I'm a bit concerned, functionally I think you are right Coolguy.

Using
-DEFAULTH &TEST = 'Main' ;
-TYPE &|TEST = &TEST
-DEFAULTH &TEST = 'Main2' ;
-TYPE &|TEST = &TEST
-INCLUDE INCLUDE_FEX
-TYPE &|TEST = &TEST


returns

&TEST = Main
&TEST = Main2
&TEST = Include

I can't see how this is correct operation.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

November 11, 2015, 08:05 PM
Waz
The official Statement is:

quote:
The first DEFAULTH does set the variable, but the second DEFAULTH does as well.
The second DEFAULTH is not considered to be a separate variable as you included it in the first fex.


I personally don't think that this is correct. Having a DEFAULTH should set the variable unless it is already set by a -SET or passed in or a previous DEFAULTH.

I guess I will have to code around this.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!