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  WebFOCUS/FOCUS Forum on Focal Point     How long do Global Variables last?
Go
New
Search
Notify
Tools
Reply
  
How long do Global Variables last?
 Login/Join
 
Expert
posted
I would love to know if there is a definitive answer to this question: how long do Global Variables (&&) last?

Upon logging in to a WF BI Dashboard, I set a global variable in a fex. Every subsequent fex checks for this global variable - if it doesn't exist, I halt all proceedings.

I haven't been able to figure out how long the global variable lasts - sometimes it's an hour, sometimes it's a minute...

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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
That wierd and a bit of a concern.

I thought that is was until your session expired.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6272 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Master
posted Hide Post
Well,

Documentation says:
"Because WebFOCUS creates a new WebFOCUS session on the WebFOCUS Reporting Server each time it submits a request, values for global variables are not retained between report requests. This means that you can use the same global variable in more than one procedure as long as these procedures are called in the same request.
"


So, I guess it's the "agent". Any subsequent request that are handled by the same agent will make you feel like it's working. Pure luck.


G'luck
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Since WF doesn't maintain a persistent connection, it should last only as long as your connection exists. The better place to put your global variable may be in the site profile or in the server profile, whichever is better suited for your needs.


WF 7.7.04, WF 8.0.7, Win7, Win8, Linux, UNIX, Excel, PDF
 
Posts: 175 | Location: Pomona, NY | Registered: August 06, 2003Reply With QuoteReport This Post
Master
posted Hide Post
Global variables will last as long as any particular request runs. Once the request finishes they're dropped. Now, I've had global variables get dropped in I-Way calls that pass from one flow to the next and in chains of focexecs that use the EX command. I've always been able to wiggle out of the problem and I don't know if it's been due to a WF bug or me just violating the rules. In general I take great care to pass them from one process to the next, which pretty much means they're not global. But if WF chooses to kick off a new process then it won't have a copy of the variables that are "global". So rather than run the risk I explicitly pass them to take control of the situation.

I used to do something similar at an old customer site, but I didn't set it at login. I used the end-user's MRE ID to look up and set global variables each time they submitted a request (i.e., a focexec runs in the global profile or gets set in site.ws). The MRE ID is global, but it's embedded in the session cookie that gets passed each time the user reaches out to the server. It lasts until the cookie expires.

You can create an encrypted cookie of your own and embed user values there, but it's kind of a hassle. Having the values in a flat file or in a DB table lets you load them up on short notice for each request.

J.

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



 
Posts: 976 | Location: At the Mast | Registered: May 17, 2007Reply With QuoteReport This Post
Master
posted Hide Post
One of the things I learned programming phone switches years ago is that there's essentially three levels of variable:

1. Truly global, applies to all processes on the system.
2. User-specific, applies to all processes for a particular user.
3. Thread-specific, applies to just the current thread of execution.

In general, #2 was most problematic both technically (difficult to implement in the server software and more prone to bugs on your delivery platform) and most problematic logically (not cooperative with concurrency, recursive processes or multiple-platform execution). Whenever I could I'd promote User-specific variables up to #1 in the rare occasions I could, or demote it to #3 with values being captured on the fly for each run. Sometimes I had no choice -- I truly needed something to be in category #2, but I always new I'd get errors that fit into the "frikkin' weird" category when I did. In spite of looking relatively similar to #3 they're just stranger. They can change value midway through a run and that can really throw a wrench into the machine.

J.



 
Posts: 976 | Location: At the Mast | Registered: May 17, 2007Reply With QuoteReport This Post
Expert
posted Hide Post
We're using MFD Profile and a global variable that is set upon login or upon a BID view change. I'm trying to predict how long the global variable is around for. If it's only around while the requests use the same agent, then this is an unpredictable amount of time - my guess is that more logged-in users means more agents being reused, therefore a bigger chance of the global variable disappearing.

This doesn't seem a very reliable setup, it makes more sense to use a cookie...

FILENAME=table-name, SUFFIX=SQLMYSQL, MFD_PROFILE=appfolder/fex-name, $
 VARIABLE NAME=&&VARNAME,  $


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Master
posted Hide Post
quote:
One of the things I learned programming phone switches years ago is that there's essentially three levels of variable:

1. Truly global, applies to all processes on the system.
2. User-specific, applies to all processes for a particular user.
3. Thread-specific, applies to just the current thread of execution.


We handle 1 in the system profile and 3 in the executing fex. Have no use for #2 but if I did it would be in the user profile. I don't use #2 because I don't want to manage thousands of user profiles.

My experience is that global variables last as long as you don't do give up your agent.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 955 | Location: Oklahoma City | Registered: October 27, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Sorry guys, but global variables do persist agent calls, and will persist the entire session. The globals are bound to the cookie. If you look into the cookie, it will name a file (I believe with a .tmp extension and will be found in the webfocus/temp directory). This file contains the SET statements for the globals. That file is referenced by the WFS files when a request is made, and the global settings are inserted into the "final" request that is being sent to the server for execution. On a side note, the global SETs are inserted after local variables are set, and before the site profile is called.

The global variable file will be invalidated when the cookie is invalidated (removed at logout), or 1 1/2 hours on inactivity happens. You can also have potential problems if the variable name - including && - is greater than 11 characters. The thing I see most from developers is that they jump between Dev Studio and the browser. If you use the same host name when developing, you can continually invalidate the cookie when you logout of a BID test or disconnect from dev studio.

To prevent this, what I do is use the IP address for dev studio, and use a host name for browser based testing. I never use the BID logon button in dev studio for testing my changes in the portal. I always open a browser and do an independent connection to do "live" testing.

Lastly, if you issue the following command, the output is what is put into the tmp file. If you cannot read the entire global name, then it will not get saved and reused properly:

-? && SAVEPRINT  


Ok, I forgot one last and very important thing ....

The above command is issued after every report request. If you add a new global in the procedure, then it will be picked up and written to the global file mentioned above. If you are running multiple requests in parallel, then you could remove some global settings without knowing it. For example, if you have two auto execute IFRAMES on a page, and both of them add a new - and different - global variable, the request that finishes last will be the global values that are saved last. So, if you intend on using global variables in your application, you should make sure you manage the creation of them in a single threaded way and be aware of how multi-threaded requests can impact the final values.

Ok ... I'm done now ...

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


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
dhagen,

Thanks for the explanation.

I wonder if setting the Dev Studio Explorer "Schedule an automatic refresh every 5 minutes" option to On is causing an invalidation of the cookie.

Also, I noticed something odd. I have error validation after each WebFOCUS request. If I have a WF error, I TABLE FILE a system table (one that does not use MDF Profile) to display an error message. This seems to invalidate the cookie...

Using the IP address for one access and the server names for the other is a great suggestion.

Regards,


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Master
posted Hide Post
If you're talking about IBIMR_user and its buddies, then yes, Dev Studio will invalidate them. I have to re-logon to my dashboards all the time when I'm running Dev Studio. I thought you were referring the global variables that you had defined yourself.

J.



 
Posts: 976 | Location: At the Mast | Registered: May 17, 2007Reply With QuoteReport This Post
Expert
posted Hide Post
Thats what I was referring to, the cookie session. (I think).

I tested this only a week or two ago, and found that I could submit one fex and set the && fars, then submit another to a different fex and see the && vars with -? &&


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6272 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
&IBIMR_user is not a global variable, but is in the WF cookie. I'm talking about my own && variables. I'll do some testing using the ideas the dhagen provided.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Platinum Member
posted Hide Post
You guys are almost correct.
In Release 7.xx.xx the && variables are maintained in the Cookie.
In Release 8.xx.xx they are maintained in the Session.


Release 7.6.9
Windows
HTML
 
Posts: 226 | Registered: June 08, 2003Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Hi,
Just bear in mind that Global variables will only be persistent from one "session" to the next if the IBIF_persistentamp setting is set to YES (typically in cgivars.wfs).
quote:
IBIF_persistentamp=YES


WebFOCUS 8.2.06 mostly Windows Server
 
Posts: 202 | Location: Johannesburg, South Africa | Registered: September 13, 2008Reply With QuoteReport This Post
Gold member
posted Hide Post
Here's another pearl for you: When you set a global variable, don't -EXIT out; be sure your code reaches the end of the fex, even with a -GOTO. We'd been scratching our heads for a long time wondering why our globals weren't "sticking," and then an SE from St. Paul suggested we try this. Once we did, the variables persisted!

Craig


v8.1.04, 64-bit Windows (Reporting Server), Apache Tomcat (Web/App Server), HTML, PDF, AHTML, Excel outputs
 
Posts: 57 | Location: Des Moines, IA | Registered: April 30, 2009Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
Release 8.xx.xx they are maintained in the Session


Another tid bit of info in WF 8, Can't wait for the general release.

It will be good to get away from cookies, security wise.

Thanks Gerry.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6272 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
If global variables are maintained in the cookie, why does a display of the cookie not show the global variable?

JSESSIONID=92C0733E9F5855C8CE5D8B52309DB353
IBIWF_language=en
MR_COOKIE=hahahehehohob9922ee10e39527bb0f1256f1157ecc2985e97001b662ff240c40a91b6eca364d998b88d2ffeac06a3fbb7a8bff0afba6ec33706a95f460b3a8651f76b21ee777afafa4cebbc29a257ba54b469f25933a0a2a662717a3a3c308b24610d6e242cbe94ae0df2b10dc62ede3a12309034cbcbf06212e1a7b88d7bce34facf27a3202fdf04cb6663393fdee733d0606c0620fba6679f243b9b80521ea9a655989eff645f756c88df355490f6eba324781722f9d7cc6c09faed578473270052510acb0da0d98ad3d077c81110c46fd27fa221cc171836bdfc809abd662f13a5cebd125c3ff20b71c1363f0dfa51376c548d01c2ee71d5e2091a3040e17950e0a749bdb12e3d74df26dc732c7303db085d0e9c5129b43f2dd5886f313f24080a116ceafdd66788de4ff5f840a6a4474a2babf17f41749786449bcebb6effec6ea8ce3aa490f3bbd626985b2da893c1bd09f26de665e22a86ea7d840221e2056d22fa3d7e6cc2d130005f0c904e4caefebb109a97d352085e7cf7e38f4fcd1c1f7a92149c8295aba303f7189bc179080ccef1451ca94ec85310a99c6463700cc93cc0faef266654e69516debb1d624d56460b2fe0cc9df0948cdad392ec6a4c649efb919ea6f6497822ab0fa74f02d666b23c4850c561eedbb97b745c1145b7c89fa39281e4edbd0df0c2defba07a44e47469941ed89e034bd0b03e98f260fce258069dc1f012fc95e19698d25eef1d5cc99ea630d44aa67cd86c6f08b2129f1cd8231hohohehehaha
WF_SESSIONID=6228971374817136463
WF_AMPERFILE=EDASERVE%3Abtxqfqxs.tmp

This message has been edited. Last edited by: Francis Mariani,


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
They are stored in this file: C:\ibi\WebFOCUS77\temp\btxqfqxs.tmp. I find all the global variables here.

-SET     &&VARNAME = 'ZXZXZX';
-SET     &&ENV = 'LOCAL';
-SET     &&LANGUAGE = 'en';


I tried sticking a -EXIT in a fex and ran it - the global variables did not disappear. I deleted the above-mentioned file - the global variables disappeared.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Master
posted Hide Post
Nice Thread

Now I have a question.

I always assumed ( since they're called GLOBAL variables ) that they are global.

As in:
If user "John" run a procedure with -SET &&NAME = 'john'
and another user runs a procedure -SET &&NAME = 'hugo' it would overwrite the global variable "NAME".

But what I read now they're not GLOBAL variables, they are SESSION variables.
Still... browser session ( like ASP ) or 'agent'-session ( request level ).

I wonder... If it is 'browser session' ( like cookies ) that could be the solution to a lot of our problems...


Greets, Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Francis Mariani:
If global variables are maintained in the cookie, why does a display of the cookie not show the global variable?

JSESSIONID=92C0733E9F5855C8CE5D8B52309DB353
IBIWF_language=en
MR_COOKIE=16afa45e380d8b9922ee10e39527bb0f1256f1157ecc2985e97001b662ff240c40a91b6eca364d998b88d2ffeac06a3fbb7a8bff0afba6ec33706a95f460b3a8651f76b21ee777afafa4cebbc29a257ba54b469f25933a0a2a662717a3a3c308b24610d6e242cbe94ae0df2b10dc62ede3a12309034cbcbf06212e1a7b88d7bce34facf27a3202fdf04cb6663393fdee733d0606c0620fba6679f243b9b80521ea9a655989eff645f756c88df355490f6eba324781722f9d7cc6c09faed578473270052510acb0da0d98ad3d077c81110c46fd27fa221cc171836bdfc809abd662f13a5cebd125c3ff20b71c1363f0dfa51376c548d01c2ee71d5e2091a3040e17950e0a749bdb12e3d74df26dc732c7303db085d0e9c5129b43f2dd5886f313f24080a116ceafdd66788de4ff5f840a6a4474a2babf17f41749786449bcebb6effec6ea8ce3aa490f3bbd626985b2da893c1bd09f26de665e22a86ea7d840221e2056d22fa3d7e6cc2d130005f0c904e4caefebb109a97d352085e7cf7e38f4fcd1c1f7a92149c8295aba303f7189bc179080ccef1451ca94ec85310a99c6463700cc93cc0faef266654e69516debb1d624d56460b2fe0cc9df0948cdad392ec6a4c649efb919ea6f6497822ab0fa74f02d666b23c4850c561eedbb97b745c1145b7c89fa39281e4edbd0df0c2defba07a44e47469941ed89e034bd0b03e98f260fce258069dc1f012fc95e19698d25eef1d5cc99ea630d44aa67cd86c6f08b2129f1cd82316dc3d13f4ca
WF_SESSIONID=6228971374817136463
WF_AMPERFILE=EDASERVE%3Abtxqfqxs.tmp


Francis, what did I tell you before about pasting your cookie values in this forum?

Anyway, I didn't think I had to be completely specific about it, but the cookie holds the file name ... as you eventually found out.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Reply With QuoteReport This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Dave:
Nice Thread

Now I have a question.

I always assumed ( since they're called GLOBAL variables ) that they are global.

As in:
If user "John" run a procedure with -SET &&NAME = 'john'
and another user runs a procedure -SET &&NAME = 'hugo' it would overwrite the global variable "NAME".

...

Greets, Dave


Dave, if you want "true" global variables, then play with FGETENV and FPUTENV. I haven't tried to make server based global variables, but I think this might work.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
dhagen,

I know you can do something with that series of characters, but can anyone else?


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
Just hope no one reads All the documentation, and you will be OK.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6272 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Master
posted Hide Post
@dhagen

I have global variables ( solved in a different way ).

I -want- session variables.

I'm just wondering wether it's browser based, or agent-based.

Greets,Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     How long do Global Variables last?

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