@All,


I've a problem with session variables...
I have two browser-screens open.....
I would expect they use different session-variables, but they are the same.
If I change one on screen 1, the value also changes on screen 2......

Is it possible to change this behaviour?

Regards,

Jeroen

Session variables are active per session; so screen 1 and screen 2 in the same session must have the same values. 

When you open the same screens in different  browsers (eg. 1 tab and a incognito tab, or chrome and firefox) you must have new session-variables. When you're open tabs in the same browser they share the same session.

Does this help you?

Matthias Preuter



Jeroen Vormer wrote:

@All,


I've a problem with session variables...
I have two browser-screens open.....
I would expect they use different session-variables, but they are the same.
If I change one on screen 1, the value also changes on screen 2......

Is it possible to change this behaviour?

Regards,

Jeroen

Hi,

With general Implementation approach, you can use HTML5 SessionStorage (window.sessionStorage). You will generate a random id and save in session Storage per Browser Tab.Then each browser tab has his own Id. 


Hope it helps.

Thanks,

Assif




@Asif: This is not the normal behavior of OutSystems Session variables.

assif_tiger wrote:

Jeroen Vormer wrote:

@All,


I've a problem with session variables...
I have two browser-screens open.....
I would expect they use different session-variables, but they are the same.
If I change one on screen 1, the value also changes on screen 2......

Is it possible to change this behaviour?

Regards,

Jeroen

Hi,

With general Implementation approach, you can use HTML5 SessionStorage (window.sessionStorage). You will generate a random id and save in session Storage per Browser Tab.Then each browser tab has his own Id. 


Hope it helps.

Thanks,

Assif




Hi Assif,


this should help me out, but I really don't know where/how to use this in Outsystems...?

BR,

Jeroen


@Jeroen: WARNING this is NOT a OutSystems / low-code solution; this will require extensive HTML5 / client scripting usage.

What is the problem that you want to solve; don't you want to use local-variables?

Matthias Preuter wrote:

@Jeroen: WARNING this is NOT a OutSystems / low-code solution; this will require extensive HTML5 / client scripting usage.

@Matthias,

your are correct.
Unfortunately our existing application uses session variables to determine what the user is doing.
Sometimes users work on multiple tabs, to do different kind of jobs.
In that case we cannot use the session variables anymore....., so I have to change the application i think....

Regards,

Jeroen


Matthias Preuter wrote:

What is the problem that you want to solve; don't you want to use local-variables?

Our users use the outsystems application to login into an external backend, end receive a token back which is stored in a session variable.
Users have to choose a domain where they gonna work on.
If they choose another domain (on another tab), the backend generates a new token.
When they return to the first tab, they think they are still working on that first domain, but the session variable token has changed on that tab also. So when they click a button something happens on the domain they have chosen on tab2, and not on the domain they think they are working on on tab1........


Jeroen Vormer wrote:

@All,


I've a problem with session variables...
I have two browser-screens open.....
I would expect they use different session-variables, but they are the same.
If I change one on screen 1, the value also changes on screen 2......

Is it possible to change this behaviour?

Regards,

Jeroen


Information on that case should be saved in screen variables. That way different tabs with the same page will be autonomous.


If the information is heavy, save it to database. You can generate a unique id in screen preparation, save it in a page variable and use that id to identify the corresponding records in the database. Remember to clear the table regularly so it doesn't grow too much with trash.

Thanks Nuno!
Indeed this is the solution i'm thinking about.
Unfortunately in our application a lot of work....

Thanks!

Matthias Preuter wrote:

Session variables are active per session; so screen 1 and screen 2 in the same session must have the same values. 

When you open the same screens in different  browsers (eg. 1 tab and a incognito tab, or chrome and firefox) you must have new session-variables. When you're open tabs in the same browser they share the same session.

Does this help you?

Matthias Preuter



Yup, this is why Internet Explorer has this:

Now, I'm not suggesting you use Internet Explorer, in fact, if you are, please stop it, but there was a point to that menu option.

In Chrome your only option is to use the incognito mode, which is a bit clumbersome. In Firefox I'm told you can use this handy extension but I've never tried it.