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     [CLOSED] Pass global variable to Maintain

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Pass global variable to Maintain
 Login/Join
 
Gold member
posted
Hi,
In the lead focexec, the global variable &&DEPT is set to a value. This focexec then calls an HTML form as follows: -HTMLFORM Dashboard.htm. When the user clicks a link, a Maintain is called. In the Maintain's top case the statement -> Compute xdept/a6 = IWC.GetAppCGIValue("DEPT"); does not retrieve any value. Please inform me what is missing.
Thank you,
Nick

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


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Platinum Member
posted Hide Post
Dear Dr. Nick
The lead focexec, Dashboard.htm and the maintain procedure are 3 independent entities.

In order to use the &&DEPT global variale in Dashboard.htm you have to reference or assign it to an object in the htm document (using a hidden input field would be one way).

Is the link to the Maintain procedure a normal hyperlink or is a form submitted? This will determine how you pass the value of &&DEPT to the Maintain procedure.


--------------------------------------------------------------------------------
prod: WF/AS 8.2.05; OmniGen;
In FOCUS since 1991
 
Posts: 104 | Location: United Kingdom | Registered: February 07, 2008Report This Post
Gold member
posted Hide Post
Hi Clinton Side-Kick,
Thanks for the response. The Maintain is called by a hyperlink. The global variables will be used to restrict drop-down lists to only those entries for that department.
Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Platinum Member
posted Hide Post
Nick,
If the following documentation does not help, share the hyperlink detail used to call the Maintain:
http://documentation.informati...6/source/topic93.htm

Regards,
Clinton


--------------------------------------------------------------------------------
prod: WF/AS 8.2.05; OmniGen;
In FOCUS since 1991
 
Posts: 104 | Location: United Kingdom | Registered: February 07, 2008Report This Post
Gold member
posted Hide Post
Hi Clinton,
This is a multi-part process:
1. User logs into a web portal
2. x.fex sets two global vars: EMPLIDX and DEPT
3. x.fex calls an HTMLFORM
4. HTMLFORM has hyperlink
5. Link calls Maintain

Values are not received by Maintain. Contents of parts 2 through 5 are as follows:

x.fex
-SET &&EMPLIDX = '1234567';
-SET &&DEPT = '123';
-HTMLFORM ZZZ.htm

HTMLFORM
hyperlink -> IBFS:/localhost/DEV/tms/Select_XY.mnt

Maintain
compute dept/a6 = IWC.GetAppCGIValue("DEPT");
compute emplidx/a7 = IWC.GetAppCGIValue("EMPLIDX");

dept and emplidx are blank.

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Platinum Member
posted Hide Post
Nick,
Have a look at the following example, it sounds like what you are missing is having the value of &&DEPT available in the HTTP header of your HTMLFORM from which the MAINTAIN procedure is being called:
Here's an example of drilling down to a JavaScript function that passes 5
parameters and calls Maintain:

-* File DrillToJS.FEX
-* - The selection of TITLE, DIRECTOR, RATING, MOVIECODE, and RELDATE will
-* be passed to the JavaScript function, RUNMNT.
-*
-* - RUNMNT is embedded in -HTMLFORM underneath the TABLE request. The
-* function will launch the Maintain procedure, TESTPROBLEMS, and pass five
-* CGI parameters.

-* - a. The five parameters (TITLE, DIRECTOR, RATING, MOVIECODE, and RELDATE)
-* are first passed to the RUNMNT JavaScript function in stylesheet.
-* b. Then retrieved as SelTITLE, SelDIRECTOR, SelRATING, SelMOVIECODE, and
-* SelRELDATE in RUNMNT
-* c. And passed to WebFOCUS CGI as &title1, &director1, &rating1,
-* &moviecode1, and &reldate1.
-*
TABLE FILE MOVIES
PRINT DIRECTOR RATING MOVIECODE RELDATE
BY TITLE
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=N1,
JAVASCRIPT=RUNMNT(TITLE DIRECTOR RATING MOVIECODE RELDATE),
$
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN

<script language ="JavaScript">
function RUNMNT(SelTITLE, SelDIRECTOR, SelRATING, SelMOVIECODE, SelRELDATE)
{
var cmd = "http://localhost/cgi-bin/ibi_cgi/ibiweb.exe?IBIS_connect=on";
cmd += "&" + "IBIC_server=edaserve" + "&" + "IBIAPP_app=SESSION";
cmd += "&" + "title1=" + SelTITLE;
cmd += "&" + "director1=" + SelDIRECTOR;
cmd += "&" + "rating1=" + SelRATING;
cmd += "&" + "moviecode1="+ SelMOVIECODE;
cmd += "&" + "reldate1=" + SelRELDATE;
cmd += "&" + "IBIF_cmd=MNTCON EX TESTPROBLEMS";
window.open(cmd);
}













-HTMLFORM END
-***************** END OF FILE ********************

-* TESTPROBLEMS.MNT
-* Use IWC.GetAppCgiValue to retrieve the WebFOCUS CGI values into a computed
-* field. My example will type out the values and restrict stack to only
-* records that fit criteria.
MAINTAIN FILE movies
Case Top
compute GetTitle/a0 = IWC.GetAppCgiValue("title1");
compute GetDirector/a0 = IWC.GetAppCgiValue("director1");
compute GetRating/a0 = IWC.GetAppCgiValue("rating1");
compute GetMoviecode/a0 = IWC.GetAppCgiValue("moviecode1");
compute GetReldate/a0 = IWC.GetAppCgiValue("reldate1");

type
"<Reposition movies.MOVINFO.MOVIECODE ;
Stack clear stk1 ;
For all next movies.MOVINFO.MOVIECODE into stk1
Where (TITLE EQ GetTitle); -* Bind stk1 to a Grid or HTMLTable
Winform Show Form1;
EndCase
END
-******************* END OF FILE *********************


--------------------------------------------------------------------------------
prod: WF/AS 8.2.05; OmniGen;
In FOCUS since 1991
 
Posts: 104 | Location: United Kingdom | Registered: February 07, 2008Report This Post
Gold member
posted Hide Post
Hi Clinton,
Changed from hyperlink to onclick event as follows:

function image3_onclick(ctrl) {
var emplidx = !IBI.GLB.EMPLIDX;
var dept = !IBI.GLB.DEPT;
var today = new Date();
var cmd = "/ibi_apps/WFServlet?IBIS_connect=on"+ "&" + "IBIC_server=edaserve" + "&" + "IBIAPP_app=tms";
cmd = cmd + "&" + "IBIF_cmd=MNTCON EX Select_Name_PP";
cmd = cmd + "&" + "EMPLIDX=" + emplidx + ";"
cmd = cmd + "&" + "DEPT=" + dept + ";";
cmd = cmd + "&" + "CurrentStamp=" + today.getTime();
document.location.href = cmd;
}
//End function image3_onclick

Technique did pass variable values but yields the following issues:

1. First execution passes dept correctly but emplidx has semi-colon as the last character, e.g. 123456;
2. Second execution gives an error 'IBI' is undefined in the message area.
3. Variable values are stated in the URL. This is a security risk.

Is there another way of passing global variables?

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Gold member
posted Hide Post
Hi Clinton,
Took a different approach and almost there. New approach executes WebFOCUS procedure from a Maintain as follows:

Maintain:
INFER TIMEKEEP.EMPLID INTO EMPXSTK;
EXEC SET_EMPLIDX KEEP INTO EMPXSTK;
COMPUTE EMPLIDX/A7 = EMPXSTK.EMPLID;
COMPUTE XDEPT/A6 = EMPXSTK.DEPT;

SET_EMPLIDX:
TABLE FILE TIMEKEEP
PRINT EMPLID DEPT
IF EMPLID EQ &&EMPLIDX
ON TABLE PCHOLD
END

Get Message 3690. It seems that WebFOCUS is looking to resolve the global variable. If I set the global variable in the focexec to a value, all is OK. For Example:
-SET &&EMPLIDX = '1234567';
TABLE FILE TIMEKEEP
PRINT EMPLID DEPT
IF EMPLID EQ '&&EMPLIDX'
ON TABLE PCHOLD
END

It seems the setting of the global variable in a previous focexec does not hold.

Feel like a rat in a maze!!!

Thanks for your help,
Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Platinum Member
posted Hide Post
Nick,
The trick is to keep things simple.
These challenges are only as complicated as we make them out to be. Stop, breath, think (SCUBA advise for underwater crisis management).

I noticed a ; being missing at the end of the line where you add the EMPLIDX parm to the cmd var.
To prevent the parameters from displying in the URL (point 3), you should rather submit a form with method="post".
Here is another example that combines js and a html form (main objective here is not to cache the URL):

To pass paramters from a FOCEXEC to a Maintain procedure, you can include
the HTML in the FOCEXEC using HTMLFORM and then use JavaScript to pass
the parameters. To prevent the URL from being cached, use the Expires and
Pragma meta tags.

Here is an example of how to pass two parameters from a WebFOCUS report to
the JavaScript function in the HTMLFORM, submit the parameters along with the
Maintain launch page without caching the URL, and then retrieve the parameters
in a Maintain procedure.

DRILLDOWN.FEX
-------------
TABLE FILE MOVIES
PRINT TITLE BY DIRECTOR
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=N1, JAVASCRIPT=RunMaintain(DIRECTOR TITLE), $
ENDSTYLE
END
-RUN

-HTMLFORM BEGIN



<script language="JavaScript">
function RunMaintain(DirectorName,MovieName)
{
alert ("Director: " + DirectorName + " / Movie title: " + MovieName);
startform.IBIF_cmd.value =
"MNTCON CLOSEMSH;MNTCON APPPATH IBISAMP;MNTCON EX MNTIVP";
startform.DirectorName.value = DirectorName;
startform.MovieName.value = MovieName;
startform.submit();
}










-HTMLFORM END

MNTIVP.MNT
----------
MAINTAIN
DECLARE GetDirName/a30 = IWC.GetAppCgiValue("DirectorName");
DECLARE GetMovieName/a30 = IWC.GetAppCgiValue("MovieName");
CASE TOP
Type "Selected Director Name: < Type "Selected Movie Title: < Winform Show Form1;
EndCase
END

You should be able to modify this to suite your requirements.


--------------------------------------------------------------------------------
prod: WF/AS 8.2.05; OmniGen;
In FOCUS since 1991
 
Posts: 104 | Location: United Kingdom | Registered: February 07, 2008Report This Post
Gold member
posted Hide Post
Hi Clinton,
Tried your technique but received error message "startform not defined". It seems that if there is a way to get the value of a global variable, any one of these techniques would function properly.

The best case, so far, functions properly for the first execution of the code but gets the error message 'IBI' is undefined for the second execution. Here I am using javascript code -> var dept = !IBI.GLB.DEPT; to capture the global variable value.

Any suggestions to retain, pass or store a global variable?
Thank you,
Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Platinum Member
posted Hide Post
Sorry Nick,
I should have noticed that the html code was not being displayed (here is the section again):

-HTMLFORM BEGIN
<HTML>
<meta http-equiv="Expires" content="Tue, 20 Aug 1996">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
function RunMaintain(DirectorName,MovieName)
{
   alert ("Director: " + DirectorName + " / Movie title: " + MovieName);
   startform.IBIF_cmd.value     =
       "MNTCON CLOSEMSH;MNTCON APPPATH IBISAMP;MNTCON EX MNTIVP";
   startform.DirectorName.value = DirectorName;
   startform.MovieName.value    = MovieName;
   startform.submit();
}
</script>
<form action="/cgi-bin/ibi_cgi/ibiweb.exe" method="post" name="startform">
<input type="hidden" name = "IBIF_cmd"     value = "">
<input type="hidden" name = "IBIS_connect" value = "on">
<input type="hidden" name = "IBIC_server"  value = "edaserve">
<input type="hidden" name = "IBIAPP_app"   value = "CUSTOMERS">
<input type="hidden" name = "DirectorName" value = "">
<input type="hidden" name = "MovieName"    value = "">
</form>
</HTML>
-HTMLFORM END


--------------------------------------------------------------------------------
prod: WF/AS 8.2.05; OmniGen;
In FOCUS since 1991
 
Posts: 104 | Location: United Kingdom | Registered: February 07, 2008Report This Post
Gold member
posted Hide Post
Hi Clinton,
Thanks for the4 info. I modified it slightly to accomodate my situation and now I get a blank page. Code is:

-HTMLFORM BEGIN



<script language="JavaScript">
function RunMaintain()
{
var dept = !IBI.GLB.DEPT;
var emplidx = !IBI.GLB.EMPLIDX;
alert ("DEPT: " + dept + " / EMPLIDX: " + emplidx);
startform.IBIF_cmd.value =
"MNTCON CLOSEMSH;MNTCON APPPATH IBISAMP;MNTCON EX Select_Name_PP";
startform.DEPT.value = dept;
startform.EMPLIDX.value = emplidx;
startform.submit();
}










-HTMLFORM END

The global variables are set but do not display via the alert. Any suggestions?
Thank you,
Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Gold member
posted Hide Post
Hi Clinton,

Missing part:











-HTMLFORM END

Thanks,
Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Gold member
posted Hide Post
Hi Clinton,
Let's try this again, this time the lines are commented:

-*
-*

-*
-*
-*
-*
-*
-*
-*

-*

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Gold member
posted Hide Post
Hi Clinton,
Another try at posting the form lines:

-*

-*
-*
-*
-*
-*
-*
-*

-*

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report This Post
Platinum Member
posted Hide Post
my you are having fun...
;-)
when you post, above this text input area there are buttons: use the last one on the right ("Code - UBBCode" red
 </> 
), then copy your code between the tags


--------------------------------------------------------------------------------
prod: WF/AS 8.2.05; OmniGen;
In FOCUS since 1991
 
Posts: 104 | Location: United Kingdom | Registered: February 07, 2008Report This Post
Gold member
posted Hide Post
Hi Clinton,
Got interesting technique from Mark (Maintain Guru at IBI). Here it is:
Inside the Maintain code issue:

EXEC GETVARS

COMPUTE var1/a10 = Focmsg(1).msg;

COMPUTE var2/a10 = Focmsg(2).msg

Etc...



In Maintain, whenever you EXEC something, and there is output returned to the screen, it is returned in FOCMSG.MSG. So, in the GETVARS.FEX you will have:



-TYPE &var

-TYPE &&VAR

Etc…



Have a –TYPE & line in the FEX for each variable, and have a COMPUTE line in the MAINTAIN for each variable. Name them what ever you want.

In addition, the first instruction in GETVARS is to EX GLOBALSET. GLOBALSET re-establishes the global variables.

This is a Maintain only solution.

I will work with your suggestion as it will be required in the non-Maintain part of the system. The code still produces a blank page and I would like to get it to function properly. Here is the latest version.

-HTMLFORM BEGIN
<HTML>
<meta http-equiv="Expires" content="Tue, 20 Aug 1996">
<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
function RunMaintain()
{
   var dept = !IBI.GLB.DEPT;
   var emplidx = !IBI.GLB.EMPLIDX;
   alert ("DEPT: " + dept + " / EMPLIDX: " + emplidx);
   startform.IBIF_cmd.value     =
       "MNTCON CLOSEMSH;MNTCON APPPATH IBISAMP;MNTCON EX Select_Name_PP";
   startform.DEPT.value = dept;
   startform.EMPLIDX.value = emplidx;
   startform.submit();
}
</script>
<form action="/cgi-bin/ibi_cgi/ibiweb.exe" method="post" name="startform">
<input type="hidden" name = "IBIF_cmd"     value = "">
<input type="hidden" name = "IBIS_connect" value = "on">
<input type="hidden" name = "IBIC_server"  value = "edaserve">
<input type="hidden" name = "IBIAPP_app"   value = "TMS">
<input type="hidden" name = "DEPT"         value = "">
<input type="hidden" name = "EMPLIDX"      value = "">
</form>
</HTML>
-HTMLFORM END
  


Thank you very much for you help. Please advise.

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
 
Posts: 83 | Registered: February 26, 2009Report 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     [CLOSED] Pass global variable to Maintain

Copyright © 1996-2020 Information Builders