Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    Conditional fex execution based on variable table
Go
New
Search
Notify
Tools
Reply
  
Conditional fex execution based on variable table
 Login/Join
 
Silver Member
posted
I'm a little unclear about how to control the flow of procedure execution and I would really appreciate some input.

I have a custom wfext plugin which is setting variables in (what I think is the) WebFOCUS variable table based on encrypted authentication parameters passed in the report request URL. When the Java plugin is called it is passed a String[] parameter called NewVars. I use

NewVars[0] = "ROLE=" + userRole

to set a variable showing the requestor's privileges. From what I understand this ROLE variable goes into the variable table. However, I'm not sure how to access this in my procedure. I want to kill / prevent execution of a procedure if ROLE is not a member of a short list.

I assumed I could use a DM IF statement and reference the ROLE variable, but it doesn't seem to have an effect. I created two DM Labels called 'AUTH_PASS' and 'AUTH_FAIL' and placed each of these in front of a different report within the procedure viewer, with the idea that only the relevant report would be generated, but the condition doesn't seem to be working. I always get the AUTH_FAIL report.

I have included the text of my procedure below (as you'll see this obviously isn't the final version, but rather for testing). Any help would be very much appreciated. I already tried 'IF ROLE==...' and 'IF &ROLE=...' but these either errored or made no difference.

-* File Role_Test.fex
SET EMPTYREPORT = ON
-IF ROLE='SysAdmin' THEN GOTO AUTH_PASS
- ELSE GOTO AUTH_FAIL;
-AUTH_FAIL
TABLE FILE RPT_ORG_ID_COMMON_NAME_VW
PRINT
     RPT_ORG_ID_COMMON_NAME_VW.RPT_ORG_ID_COMMON_NAME_VW.COMMON_NAME
HEADING
"Auth: Failed"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K FORMULA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
TYPE=HEADING,
     LINE=1,
     JUSTIFY=LEFT,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=1,
     STYLE=NORMAL,
$
TYPE=REPORT,
     COLUMN=N1,
     WRAP=6.000000,
$
ENDSTYLE
END
-AUTH_PASS
TABLE FILE RPT_ORG_ID_COMMON_NAME_VW
PRINT
     RPT_ORG_ID_COMMON_NAME_VW.RPT_ORG_ID_COMMON_NAME_VW.COMMON_NAME
HEADING
"Auth: Passed"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K FORMULA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
TYPE=HEADING,
     LINE=1,
     JUSTIFY=LEFT,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=1,
     STYLE=NORMAL,
$
TYPE=REPORT,
     COLUMN=N1,
     WRAP=6.000000,
$
ENDSTYLE
END


WebFocus 7.7
Windows Server 2008 R2
HTML Reporting
 
Posts: 32 | Registered: September 19, 2011Reply With QuoteReport This Post
Platinum Member
posted Hide Post
&ROLE is proper but 2 other problems will cause this not to work.

1. The main problem is the use of "=" instead of the proper "EQ" on your branching line. This is a common error and I make it often enough.

2. You need to either add an "-EXIT" before the "-AUTH_PASS" or put in a "-GOTO " and add the label to the end. I prefer using "-GOTO". This is needed so if "-AUTH_FAIL" runs, "-AUTH_PASS" doesn't run.

First, ensure each of the two TABLE request run fine separately.
Second, make sure your DM "&ROLE" variable is populated with the value you want.
If good, then here is my suggestion for your code [Changes colored in RED]:

[CODE]
-* File Role_Test.fex
SET EMPTYREPORT = ON
-IF &ROLE EQ 'SysAdmin' THEN GOTO AUTH_PASS
- ELSE GOTO AUTH_FAIL;
-AUTH_FAIL
TABLE FILE RPT_ORG_ID_COMMON_NAME_VW
PRINT
RPT_ORG_ID_COMMON_NAME_VW.RPT_ORG_ID_COMMON_NAME_VW.COMMON_NAME
HEADING
"Auth: Failed"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K FORMULA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
TYPE=HEADING,
LINE=1,
JUSTIFY=LEFT,
$
TYPE=HEADING,
LINE=1,
OBJECT=TEXT,
ITEM=1,
STYLE=NORMAL,
$
TYPE=REPORT,
COLUMN=N1,
WRAP=6.000000,
$
ENDSTYLE
END
-GOTO ENDTEST
-AUTH_PASS
TABLE FILE RPT_ORG_ID_COMMON_NAME_VW
PRINT
RPT_ORG_ID_COMMON_NAME_VW.RPT_ORG_ID_COMMON_NAME_VW.COMMON_NAME
HEADING
"Auth: Passed"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K FORMULA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
TYPE=HEADING,
LINE=1,
JUSTIFY=LEFT,
$
TYPE=HEADING,
LINE=1,
OBJECT=TEXT,
ITEM=1,
STYLE=NORMAL,
$
TYPE=REPORT,
COLUMN=N1,
WRAP=6.000000,
$
ENDSTYLE
END
-ENDTEST



In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle
 
Posts: 161 | Location: Dallas, TX | Registered: February 20, 2009Reply With QuoteReport This Post
Silver Member
posted Hide Post
Thanks very much for the info DavSmith

I have tried with your suggestions but I'm still having some issues - I currently have parameter prompting on (XMLPROMPT) and when I try to run my report I am prompted for the ROLE parameter. If I turn parameter prompting off I just get an error.

Do you know if I need to do anything else to transfer the ROLE parameter I set in my plug-in through
NewVars[0] = "ROLE=SysAdmin"

to be available to my report? I have seen the functions like CopyWFVarToSessionVar but I don't really understand the terminology enough to know if this is what I need

Any suggestions much appreciated!


WebFocus 7.7
Windows Server 2008 R2
HTML Reporting
 
Posts: 32 | Registered: September 19, 2011Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Hi Tom, Glad it helped somewhat. Unfortunately, I'm not familiar with the IWAY environment or Java plugins so I can't answer you're question as to how to get your &ROLE variable populated so that the paramter prompting does not occur.

Any IWAY/Java experts out there willing to help Tom? If not, a call to the IBI Helpline is your best bet.

Good luck

David



In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle
 
Posts: 161 | Location: Dallas, TX | Registered: February 20, 2009Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Tom, couldn't you just default &ROLE to "something" at the beginning of the procedure to avoid DM complaining about the non-existence of it?

-DEFAULTH &ROLE='NONE'
SET EMPTYREPORT = ON
-IF &ROLE EQ 'SysAdmin' THEN GOTO AUTH_PASS
- ELSE GOTO AUTH_FAIL;
...


If this procedured is EXEC'd later on and passed a value for &ROLE this new value will take precedence and will override 'NONE' anyway.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Reply With QuoteReport This Post
Silver Member
posted Hide Post
Thanks for your suggestion njsden but there was no change in my report. The syntax highlighting in Developer Studio did not recognise the default(h) statement or any of the variations I tried. Are you sure this syntax is valid for 7.7?

According to IBI support my problem is that I am creating an Application Server session variable in my plugin, which must then be copied to a WebFOCUS variable. They suggested I tried the CopySessionVarToWFVar method, but this is currently returning errors.

Here's hoping I get my problem solved before new year...


WebFocus 7.7
Windows Server 2008 R2
HTML Reporting
 
Posts: 32 | Registered: September 19, 2011Reply With QuoteReport This Post
Silver Member
posted Hide Post
Thanks again for all the suggestions on this.

In the end a solution was found by the IBI support people.

The Java plugin is still setting the ROLE variable in the same way (NewVars[0] = "ROLE=SysAdmin") and the site.wfs needed to look like this:

<VER 1>
# $Revision: 1.5 $ 
# place any variables here from cgivars.wfs that you wish to override.

<call> checkAuth()
<SET>ROLE(PASS)


WebFocus 7.7
Windows Server 2008 R2
HTML Reporting
 
Posts: 32 | Registered: September 19, 2011Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    Conditional fex execution based on variable table

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.