Skip to main content

 

Developing an Application

 

OutSystems

Maintain State while Navigating across Screens

Maintaining the application state of an app refers to keeping the values between changes of Screens.

Application state in Reactive Web Apps and Mobile Apps

In Mobile and Reactive Web apps, the state of the previous Screens is automatically maintained if the end-users use the back button. For more flexibility in development you can use Client Variables.

For an idea on how to use Local Storage to maintain the state of Screens in mobile apps, check the FAQ How to maintain the state of a mobile screen.

Example: Share values of Client Variables across apps

Here is a detailed example of how you can create two apps and share a Client Variable between them. We're using a Block to share the value, but you can do the same with a public Client Action.

Create the first app and a Client Variable

  1. Create a sample Reactive Web App, name it ReactiveAppA, and add a Web Module to it. When the editor opens, add a Screen to the app.
  2. Go to the Data tab > right-click Client Variables > select Add Client Variable. Name the variable MyClientVariable.
  3. Go to the Logic tab > right-click Client Actions > select Add System Event > select On Application Ready.
  4. Drag an Assign Tool to the Flow and assign Client.MyClientVariable = "Value from ReactiveAppA!". This sets a value to the variable once the app starts running.
  5. Add a Block to MainFlow and name it BlockWithClientVariable. Drag an Expression Widget to the Block and enter Client.MyClientVariable in the Expression Value of the Widget.
  6. Drag BlockWithClientVariable to the Screen.
  7. Set Public property ot BlockWithClientVariable to Yes.
  8. Publish the app and open it in a browser.

Sample App A with a Client Variable

Create the second app and pass it the value of Client Variable

  1. Create another sample Reactive Web App, name it ReactiveAppB, and add a Web Module to it. Again, add a Screen to the app.
  2. Open Manage Dependencies, search for ReactiveAppA in Producers and select BlockWithClientVariable. Click Apply to add references and close the dialog.
  3. Drag the BlockWithClientVariable to the Screen.
  4. Publish the app and open it in a browser.

Application state in Traditional Web Apps

To maintain state while navigating across screens in a Traditional Web App create a Session Variable.

  • Was this article helpful?