I have a question about session variables.

As I understand it, can a session variable be read from logic, including server action in the module that defines it? Because, in the materials they mention examples such as in user actions, screen preparations and screen actions, but it was not clear whether in Server Actions too.

Another question that was not clear to me is whether Session Variables can be of composite data types or of collection, as it says that it is not recommended, but not being recommended does not mean it is not possible, am I right?

Thank you

Hi, friend. 

Yes, you can read and manipulate those SV from server side, but remember that it is a browser data and exists only during the user session.

Yes, is possible user the SV as lists(image), for example. The reason why is not recommended the use of too many data inside a session variable is that browser will become very slow. Try to fill some SV with a binary or a long list and you will see that.

You can use session variables of any type. The point is that a variable composed by norm can be big, like a list, or a record. Why is it advisable to use only session variables of the "basic" types? Because these session variables will always be in the view state of the page ... and the bigger the view state, the slower the page is and you may experience performance breaks. For example, imagine a large list in each request to the server, moving from side to side, the page becomes slow.



Hello Karina.

On both questions, it is a matter of being aware of the full consequences.

Session Variables can be read from Server Actions and they will work if called from a screen.

But if those actions are run from elsewhere (a timer for instance) the value will be null and your logic must be ready for that.

Regarding the data you save in session, please use them only for basic and not confidential data. Search values written to input fields, maybe the username. Never userid, password, credit card numbers....

If you start using them for structures, binaries and so, you are hurting performance and wasting memory.
Architecture Dashboard is very picky on that. If you can, please join our session Thursday to learn about it