Remember user inputs when navigating beween screens

Hi all, 

I would like to implement the ability to "remember" the fields that a user inserted, for example, a dropdown selection or text in a text box when navigating away from a screen and then back again to the first screen. Can anyone please direct me in how to achieve that. 

Thanks

Larissa

Hi, friend.

You can use session variables to hold those values.

Remember that these variables must be used carrefully. You should not pass much data in there, like binaries. Use it to pass identifiers, booleans, short string, integers etc.

Best regards


Hey Larissa!

Ok so we have a few options, but can you please clarify are you building Traditional, Reactive or Mobile?
Try a few options and let me know which one works.

You can accomplish this via cookies or your databases. You're going to have to program your own cookies.

Web
Can be achieved on Service Studio via the action flow / setting cookies.  Can create cookies with properties using the HTTPRequestHandler AddHeader extension.



Or check your Module, go to the properties panel on Service Studio, and find "Use Cookies"




Mobile
In Mobile, you can use the local storage instance of cookies. Or try this component:
https://www.outsystems.com/forge/component-overview/3319/cookiemanagerplugin

Both hypotheses presented are good solutions, be careful only with the best practices, because in order not to have session variables of the structure or list type, as it leads you to have a very large view state, which is bad in terms of performance, and pay attention to the data you keep, which are not sensitive data, because otherwise with the inspect anyone can see them.


Cheers,
Miguel

Sydney Lai wrote:

Hey Larissa!

Ok so we have a few options, but can you please clarify are you building Traditional, Reactive or Mobile?
Try a few options and let me know which one works.

You can accomplish this via cookies or your databases. You're going to have to program your own cookies.

Web
Can be achieved on Service Studio via the action flow / setting cookies.  Can create cookies with properties using the HTTPRequestHandler AddHeader extension.



Or check your Module, go to the properties panel on Service Studio, and find "Use Cookies"




Mobile
In Mobile, you can use the local storage instance of cookies. Or try this component:
https://www.outsystems.com/forge/component-overview/3319/cookiemanagerplugin

Hi Sydney, sorry for not mentioning it in the first place - I am building a reactive web app. It does not seem to have the "use cookies" setting


Hi Larissa,

Do you have some entities which can hold that data? You can save them as draft and use the identifier in the session to fetch the required data whenever required. If you cannot insert records to the main transnational table/s, you can use some temporary tables to do so and keep cleaning them on regular intervals.

Like Miguel said, both performance and security will be at risk with the heavy usage of session variables.

Akshay Puri wrote:

Hi Larissa,

Do you have some entities which can hold that data? You can save them as draft and use the identifier in the session to fetch the required data whenever required. If you cannot insert records to the main transnational table/s, you can use some temporary tables to do so and keep cleaning them on regular intervals.

Like Miguel said, both performance and security will be at risk with the heavy usage of session variables.


Hi Akshay, Thank you - I have also considered to get the values back from the entities I store them, but are struggling to get the dropdown to display the previous selected value. I have seen on some forum posts that I should set the default value to the list the dropdown reads from, but the default value is "grey'd" out for some reason. 

Hi Larissa,

If you are working in a Reactive Web App (or a Mobile App) you can use a Client Variable (defined in a folder named Client Variables on the Data tab of service Studio) that will be available on your device only.

On Traditional Web Apps you can use Session Variables (like Lenon mentions) that are specific to the user interacting with the application.

For Mobile Apps it is also possible to use Local Storage entities to store some data on the device.

All of these options are actually covered in the standard online training that I strongly advise you to go through before starting to build your projects:

I'd personally stay away from messing with cookies directly if I can avoid it.

Hope this clarifies things a bit more!

Jorge Martins wrote:

Hi Larissa,

If you are working in a Reactive Web App (or a Mobile App) you can use a Client Variable (defined in a folder named Client Variables on the Data tab of service Studio) that will be available on your device only.

On Traditional Web Apps you can use Session Variables (like Lenon mentions) that are specific to the user interacting with the application.

For Mobile Apps it is also possible to use Local Storage entities to store some data on the device.

All of these options are actually covered in the standard online training that I strongly advise you to go through before starting to build your projects:

I'd personally stay away from messing with cookies directly if I can avoid it.

Hope this clarifies things a bit more!

Thanks Jorge, 

I have looked at that, and I understand my options in terms of where to store the information I would like to keep. My question is more towards how to display that stored information as the default value of my dropdown when navigating back to that screen.

So I have set the client variable to the user selection, I navigate to the next screen, then I navigate back to the first screen, where I now need the default value on the dropdown to be equal to the value of the client variable. But as per my comment on Akshay's post - the destination variable of the dropdown, does not allow me to set a default value. 

Hi Larissa,


can you show screenprints of the properties of your dropdown.  It should really be as simple as setting the right value for your 'variable' parameter of your dropdown.  I think this is where you are struggling. 

use case 1 : If you are using the dropdown to edit data from the database, it will probably look something like GetOrders.List.Current.Order.OrderType.

use case 2 : If you are using the dropdown to select a filter value that you wish to remember for later use, it wiil probably look something like Client.OrderTypeFilter.


see attached oml, on the detail screen BeatlesDrinkBeerDetail you can see example of use case 1, on the BeatlesDrinkBeers screen you see use case 2 with a filter on beatle id.


Hope this points you in the right direction,

Dorine

Larissa,

I'm with Dorine, an input will display the value the variable it is bound to has, at the time of rendering. This is true for all sorts of inputs on both Traditional Web as well as Mobile/Reactive Web.