Focal Point
[CLOSED] Using variables from a -INCLUDE in a RO

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

June 14, 2018, 10:24 AM
Doug
[CLOSED] Using variables from a -INCLUDE in a RO
This should be, and probably is, simple. But, I guess I'm missing a piece of this puzzle.

What I need it to use the variables (&UserID, used in the HEADING, and &CARZ_Filter, used as a filter) from "CARZ_Filter.fex" in "CARZ_Report_RO.fex" (The RO).

Using "-INCLUDE IBFS:/WFC/Repository/CARZ/CARZ_Filter.fex" in the "Preprocessing Other" section of the RO doesn't work, nor does it work within the "Report" section. by "doesn't work" I mean that the variables/filters aren't available in the RO when a user creates a report from it.

I have similar issue using the MFD_Profile within the synonym.

Here's the pieces to my puzzle:

The Filter
-TYPE *** CARZ_Filter.fex ***
APP PATH CARZ
-RUN

-SET &CARZ_Filter = DECODE &UserID ('Tony A' 'ENGLAND' 'Doug' 'FRANCE' 'Irene' 'ITALY' 'Jackie' 'JAPAN' 'Willie' 'W GERMANY' ELSE 'Switzerland') ;

-TYPE *** &UserID can see &CARZ_Filter ***
-* Use the HTMLFORM to run this independently from the report, just to see the results.
-*-HTMLFORM BEGIN
-*&UserID can see &CARZ_Filter
-*-HTMLFORM END
-RUN


The Report: You can change the &UserID and run this directly and see that the filter works.
-TYPE *** CARZ_Report.fex ***

-* Six test lines for SETting &UserIDs for filtration in the CARZ_Filter fex.
-SET &UserID = 'Tony A' ;
-*-SET &UserID = 'Doug' ;
-*-SET &UserID = 'Irene' ;
-*-SET &UserID = 'Jackie' ;
-*-SET &UserID = 'Willie' ;
-*-SET &UserID = 'Steve' ;

-INCLUDE IBFS:/WFC/Repository/KGPCo_IT/CARZ_Filter.fex

TABLE FILE CARZ
HEADING
"Here's &UserID.EVAL's report for &CARZ_Filter "
PRINT *
WHERE COUNTRY EQ '&CARZ_Filter.EVAL'
ON TABLE SET EMPTYREPORT ON
END


The Synonym
FILENAME=CARZ, SUFFIX=FOC,$
  SEGMENT=SEG01, SEGTYPE=S3,$
    FIELDNAME=COUNTRY,     ALIAS=E01, USAGE=A10,  TITLE='Country', FIELDTYPE=I,$
    FIELDNAME=CAR,         ALIAS=E02, USAGE=A16,  TITLE='Car',$
    FIELDNAME=MODEL,       ALIAS=E03, USAGE=A24,  TITLE='Model',$
    FIELDNAME=DEALER_COST, ALIAS=E04, USAGE=D7C,  TITLE='Dealer Cost',$
    FIELDNAME=RETAIL_COST, ALIAS=E05, USAGE=D7C,  TITLE='Retail Cost',$
    FIELDNAME=PROFIT,      ALIAS=E06, USAGE=D12C, TITLE='Profit',$


Thanks In advance,
Doug

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




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
June 14, 2018, 11:08 AM
MartinY
An assumption...

I haven't tried it myself with RO but have you tried to have your filter fex as in the universal_profile and/or have the variable as global (with two ampersand) and not local (with one ampersand) ?


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
June 14, 2018, 11:19 AM
FP Mod Chuck
Doug

I was able to make it work by putting this code in the preprocessing other section.


-SET &UserID = 'Tony A' ;
-INCLUDE IBFS:/WFC/Repository/KGPCo_IT/car_filter.fex


In the real world I think you could use &FOCSECUSER to get the ID and not have to -SET &UserID


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 14, 2018, 11:59 AM
Doug
MartinY: An assumption... That is an alternative as MFD_PROFILE. I had issues with that too and intend to use that methodology when synonyms will be directly accessed..

Chuck:
1) I was able to make it work
Interesting. I need to retry it with optimism.
    Did you just copy and paste my Report Code in to the Report section via text edit?
    Does the heading show both values?
2) &FOCSECUSER Yes, that's the real world solution. This is just a POC.

Right now, I'm analyzing several methodologies to determine which one will be the easiest to maintain.
June 14, 2018, 12:08 PM
FP Mod Chuck
Doug

Yes I pasted the code into the report section and the heading had both values. One caveat.. I created the RO against the car file so it put TABLE FILE ibisamp/car in the code but the rest of the code is yours.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 14, 2018, 12:09 PM
Hallway
You could do masterfile filtering in the Pre-Processing
 
-SET &UserID = 'Tony A' ;

-SET &CARZ_Filter = DECODE &UserID ('Tony A' 'ENGLAND' 'Doug' 'FRANCE' 'Irene' 'ITALY' 'Jackie' 'JAPAN' 'Willie' 'W GERMANY' ELSE 'Switzerland') ;

FILTER FILE ibisamp/car ADD
NAME=USERFILTER, DESC=FILTER COUNTRY BY USER ID
IF COUNTRY EQ &CARZ_Filter.EVAL
END

SET FILTER =USERFILTER IN ibisamp/car ON
 


Docs HERE


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
June 14, 2018, 12:39 PM
Doug
Chuck:
1) I was able to make it work
I retried it with optimism and got the
"Failed to save a component
  Error found while validating this component:
  Please verify the syntax and try again." message.

It's as though it doesn't like DM commands within the Preprocessing Other component.
June 14, 2018, 12:42 PM
FP Mod Chuck
Doug

Ahhh yes I forgot I did get that error and moved the HEADING after the WHERE and all was good. Go figure...


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 14, 2018, 01:03 PM
Doug
That was the second error. But, I got that error when "...putting this code in the preprocessing other section.
-SET &UserID = 'Tony A' ;
-INCLUDE IBFS:/WFC/Repository/KGPCo_IT/car_filter.fex

June 14, 2018, 01:14 PM
FP Mod Chuck
Doug

I am using 8203 and here is the code in my -INCLUDED fex. The preprocessing section saved without error.


-SET &CARZ_Filter = DECODE &UserID ('Tony A' 'ENGLAND' 'Doug' 'FRANCE' 'Irene' 'ITALY' 'Jackie' 'JAPAN' 'Willie' 'W GERMANY' ELSE 'Switzerland') ;
-RUN



Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 14, 2018, 01:38 PM
Doug
Maybe that's it, I pasted it as a -INCLUDE ...fex

Retrying... by pasting just the code from within the fex rather than the -INCLUDE ...fex

Thank you for supporting Focal Point!

This message has been edited. Last edited by: Doug,
June 14, 2018, 02:43 PM
Doug
I did get that to work Smiler without the -INCLUDE Frowner That's a step in the right direction Smiler

Preprocessing Section:
-SET &UserTest =EDIT(&FOCSECUSER,'999999999999999') ;
-SET &UserID =IF '&UserTest.EVAL' EQ 'ActiveDirectory' THEN EDIT(&FOCSECUSER,'$$$$$$$$$$$$$$$$99999999999999999999') ELSE &FOCSECUSER;
-SET &UserID=TRUNCATE(&UserID) ;
-SET &CARZ_Filter = DECODE &UserID ('Doug' 'ENGLAND' 'John' 'FRANCE' 'Ken' 'ITALY' 'Jackie' 'JAPAN' 'Willie' 'W GERMANY' ELSE 'Switzerland') ;
-RUN

Report Section:
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET SQUEEZE=ON
SET HTMLCSS=ON
SET ARGRAPHENGINE=JSCHART
-DEFAULTH &WF_EMPTYREPORT=ON;
SET EMPTYREPORT=&WF_EMPTYREPORT

SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_SUMMARY='Summary';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
TABLE FILE kgpco_it/carz
SUM CARZ.SEG01.DEALER_COST
BY CARZ.SEG01.COUNTRY
BY CARZ.SEG01.CAR
BY CARZ.SEG01.MODEL
WHERE CARZ.SEG01.COUNTRY EQ &CARZ_Filter. (|FORMAT=A10).QUOTEDSTRING;
HEADING
"Here's &UserID.EVAL's report for &CARZ_Filter "

ON TABLE NOTOTAL
ON TABLE SET STYLE *
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, SUMMARY=&WF_SUMMARY.QUOTEDSTRING, HFREEZE=OFF, $
ENDSTYLE
END

June 15, 2018, 03:36 PM
Doug
There's an issue with this methodology...

The issue is that it was created as a RO, but after editing it, as text, it no longer acts like a RO. It's just a plan fex which users cannot use for creating reports.

What now?
June 15, 2018, 05:08 PM
FP Mod Chuck
Doug

I'm not sure. That code is under the preprocessing other and can only be edited in text. I went back and tried to create a report with this RO on my machine and it allowed me to do it. I am on 8203... Sounds like it is time for techsupport...


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 17, 2018, 04:59 PM
Doug
Thanks Chuck,

I am on 8202M Gen 60. May be time for a Case.

I'm also having a "Coding Issue Using a MFD_Profile" which I'll present here in FP first, and on to a Case if needed.
July 28, 2018, 06:58 AM
Don Garland
Any word on this one....?


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL