Using Session Variable as condition in Action Step

I have used the tutorial to understand how to pass session variables between pages. This is working fine and I can display the session variable from page 1 on page 2.

I then use the same session variable as a condition in an Action Step condition for a data query. Nothing gets displayed on my page.

If I change the condition to be a static value (e.g. 4) and not the session variable then everything works OK - data from the query is displayed. I have tried defining the session variable as a text and also a number but the same result.

How can I debug this please ?

Hi @ellisdav
Server Sessions and Browser Session Variables are two completely different things.

Browsers sessions are used in your browser, using the session storage and they are only available on the frontend. They are managed using the State Management component.

Server Sessions are a different thing. Server side sessions live on server side only and are managed with server connect set/remove/get session variable action steps and also available only server side as $_SESSION.

Hi Teodor, I may be using the wrong terminology let me try again.

I have the Sessions Storage Manager added to page 1 and page 2 with a session storage variable defined. I can have this set on page 1 and then displayed on page 2.

What is being passed is the id of a person in a db table. I would like to run a query to display more information from this person record and bind it to page 2. How best should I do this (I have had issues with URL parameters and wanted to try a different technique).

So you want to use the browser seesion value to filter a database query?
If that’s what you need, create a GET variable in your server action. Use it to filter the query.

On your page, when you select the server connect component, you will see this GET variable listed as parameter. Set the session storage value as value for this parameter.

2 Likes

Teodor - thanks that is working fine.

Cheers, Dave

1 Like