Focal Point
[CLOSED] Why won't my global variable persist?

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

February 12, 2010, 01:20 PM
Kal
[CLOSED] Why won't my global variable persist?
Greetings, Focalpointers!

I am trying to set a variable as global from a list box selection in the first tab of my html & access it in filters through out my fex's in other tabs in a SINGLE browser session.

I am having multiple tabs (tab control) in a single html & each tab defaults to a html of its own & each htm has like 4 frames running graphs/reports.
I can access my set global var in all the procedures of the first tab , but not in the other tabs.

I've verified that the ibi_persstant setting is set to yes.

I've referred through the documentation resources & previous FP posts & everything seem to be indicating that my global var should last through out the browser session. What am I missing here? Please suggest!

This message has been edited. Last edited by: FP Mod Chuck,


----------------------------------
WFS - V7.6.8 Servlet on Win2k3 VM, Tomcat, ResourceAnalyzer;
DevStudio - R7.6.8, FlexEnable,VisDis; MRE/BID/self-service/Rcaster/ Office2k3;
DB-SQL2005;
February 12, 2010, 01:45 PM
Dan Satchell
Since HTML objects can only populate local variables, how are you setting the value in your global variable?


WebFOCUS 7.7.05
February 12, 2010, 02:31 PM
Kal
list box sending a local var to a fex on submit & am setting the global var in one of the procedures with in a frame.

Thanks.


----------------------------------
WFS - V7.6.8 Servlet on Win2k3 VM, Tomcat, ResourceAnalyzer;
DevStudio - R7.6.8, FlexEnable,VisDis; MRE/BID/self-service/Rcaster/ Office2k3;
DB-SQL2005;
February 12, 2010, 04:05 PM
Dan Satchell
So the users will always open and run the procedure in the first tab before going to any of the other tabs? It would be interesting to -DEFAULT the global variable before opening your first HTML page and then check it's value after running the procedure in the first tab and opening one of the other tabs.


WebFOCUS 7.7.05
February 12, 2010, 05:44 PM
Kal
Hi Dan - Thanks for writing in.
Yes, the users would always start/go to the first tab to change the client (& set the value for global var)
I've checked by defaulting it in the procedure before the first tab gets loaded it. the default val does get picked up in the procs of the first tab & even change when the value is set again.
it. when i go to the second tab...the default value is seen but not the changed val.
I am also reloading the second tab on click to verify it's not picking up the value from the first tab.


----------------------------------
WFS - V7.6.8 Servlet on Win2k3 VM, Tomcat, ResourceAnalyzer;
DevStudio - R7.6.8, FlexEnable,VisDis; MRE/BID/self-service/Rcaster/ Office2k3;
DB-SQL2005;
February 12, 2010, 06:46 PM
Dan Satchell
After thinking about it, each HTML launch page probably does open a separate session (a new call to the WebFOCUS servlet). You could try passing the value of your global variable to subsequent tabs by adding it to the HTML form that calls the WFServlet (some variation of the sample below) in those other tabs. A hidden local variable (name of your chosing) can be created with its value set to the global value, which will be passed to the servlet along with any other values from the HTML page.

<FORM name='....' action='/ibi_apps/WFServlet' method=..... >
<input type='hidden' name='IBIMR_domain' value="..../......htm">
<input type='hidden' name='IBIMR_action' value="MR_RUN_FEX">
<input type='hidden' name='IBIMR_sub_action' value="MR_STD_REPORT">
<input type='hidden' name='IBIMR_fex' value="app/......fex">
<input type='hidden' name='IBIF_ex' value="app/.....fex">
<input type='hidden' name='IBIMR_flags' value="">
<input type='hidden' name='IBIMR_folder' value="">
<input type='hidden' name='IBIMR_defer' value="">
<input type='hidden' name='IBIMR_random' value="">
<input type='hidden' name='USERACTION' value="">
<input type='hidden' name='LOCAL_VAR' value="&&GLOBAL_VAR">       <------------ add this

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
February 13, 2010, 06:55 AM
Kal
Thanks for that suggestion Dan, I'll try it out!
Best Regards & Have a great week-end!


----------------------------------
WFS - V7.6.8 Servlet on Win2k3 VM, Tomcat, ResourceAnalyzer;
DevStudio - R7.6.8, FlexEnable,VisDis; MRE/BID/self-service/Rcaster/ Office2k3;
DB-SQL2005;
February 14, 2010, 12:33 PM
FrankDutch
global variables can be set in the startup file
you can add many...

I use some like previous workday, yesterday and things like that




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 15, 2010, 01:47 AM
Tony A
That's true Frank, but as the profile gets executed as the first part of the FOCUS session the "global" variables get set each time a new fex is executed, so whilst we perceive them as persistant .......

Kal,

You might have to look at setting local cookies and their retrieval.

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 
February 17, 2010, 12:47 AM
Kal
I've tried adding the hidden variable as Dan suggested along with trying to assign the changed global var back in the server profile...but still not able to get it to work yet..
Thanks Tony for your indication- Though hoping for another route, I've started to look at taking the cookies retrieval path.
will post back the progress..
Thanks for the help.


----------------------------------
WFS - V7.6.8 Servlet on Win2k3 VM, Tomcat, ResourceAnalyzer;
DevStudio - R7.6.8, FlexEnable,VisDis; MRE/BID/self-service/Rcaster/ Office2k3;
DB-SQL2005;
February 17, 2010, 06:25 AM
Dr. Nick
Hi Kal,
I've had success saving amper variables as session variables. Session variables are set and reset in site.wfs. They can be used in focexecs and passed to maintains. Some of my past posts to focal point contain this technique.

I must run now but can detail this technique, if you are interested.

Please advise.

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
February 17, 2010, 09:50 AM
Francis Mariani
Dr Nick, please elaborate.

Thanks,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
February 18, 2010, 07:36 AM
Dr. Nick
Hi,

In my application, we post the userid of the person entering the system from the portal to WebFocus. A focexec is also called from the post statement. Since all focexecs call site.wfs, I have an "if" statement identifying the first or subsequent pass of site.wfs.

The first time sets the session variable and subsequent passes retrieve the session variable. In each cases, a focexec is called setting the local variable to a global variable using the statement "-SET &&ID = '&ID.EVAL';".

The global variable can now be used in a focexec.

In a Maintain, COMPUTE a variable as follows:
"COMPUTE ID = IWC.GetAppCGIValue("ID");" and test for a null value. If null, the values was not passed.

Hope this helps.

Nick


WebFOCUS 7.7.03 & 8.0.7
Windows
HTML, Excel, PDF, etc.
Also, using Maintain, etc.
June 29, 2013, 12:54 AM
badri
Hi Kal,
I faced a similar issue regarding dropdowns and passing the selected value to some other fex. i worked for sometime and realized that if i store the value from the dropdown to a global variable,and call the global variable in some other fex which uses that value to filter and stuff like that.it just works fine.
I dont know whether this will help u.
I tried sending it through forms but with no luck.

My global variable persists even if i close the browser and open it back. it still holds the value i selected last time.

Thanks
Badri


WF 7.6.11,
oracle 11g ,windows
PDF , excel, AHTML
September 15, 2014, 11:05 AM
Wep5622
I found that explicitly calling -EXIT in a fex procedure erases session-global variables. I consider that a bug and have opened a case. Just in case anyone else runs into this.

We were using an && variable to pass on some session data through drilldowns, but sometimes the && variable was suddenly not set anymore. At first we suspected session time-out, but it was happening too soon for that. Replacing a few -EXIT statements with -GOTO :END and a -:END label at the end of each procedure resolved the issue.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
August 19, 2017, 12:19 PM
ColleyvilleWF
The -EXIT in the procedure terminates the procedure and prevents the global variables from being written back to the .tmp file in your webfocus\temp folder associated with your browser session.


WF 4.3 - 8.2
Windows\Unix