388
Views
4
Comments
Solved
How to persist data between modules?
Question
Application Type
Reactive

Hello! So I recently made a question about having some data stored even when we change the page. And for that we can use client variables that keep the information. . But when we move to another module, we no longer have access to those variables!

An example, I go fecth information about the user, and I take the areas associated to the user.. I dont want to make more queries, o I want to store that list of areas in some place.. Not only client variables do not accept this type of data,I also dont have access to this in other modules.

How to keep a list saved while the session is up? :) 

All help is appreciated! :)

2018-10-29 08-31-03
João Marques
 
MVP
Solution

When creating references, you should always take into account your architecture. Being that said, a side reference is not necessarily a violation, between core applications / modules for instance it is actually quite common. You should see if it makes sense on your architecture to have that side reference or to have a module in a level below.

Regarding the allowed value types in client variables, indeed lists and records are not allowed.

If you would be working on Mobile, I would suggest using Local Storage which is not allowed in Reactive applications.

As I see it, you only have two options to persist tables and records in a Reactive application:

  1. Save the record or data in a serialized JSON in a text Client Variable
    • Pros: Having data in client side means you don't need to go to server side to get this information which is better for performance. Besides it will work offline.
    • Cons: Having to serialize / de-serealize is a hassle which will increase the effort to maintain and to read the code
  2. Save the record in the database:
    • Pros: Persisting and reading this information is more transparent and of course the limits are way different than the client variable.
    • Cons: Performance-wise, there will be round-trips to server and to the database. It also does not work offline.


And of course, don't forget to avoid storing confidential information on client variables.


Kind Regards,
João

2018-10-29 08-31-03
João Marques
 
MVP

Hi Ricardo,


If you intend to use client variables from module A in module B, you can easily create two actions in module A (one that returns the value of the client variable and another that receives the value and assigns to the client variable) and reference / consume them in module B.

You should do the exact same thing with database actions where you expose wrappers that perform CRUD actions to be used by the consumer modules.


Kind Regards,
João

2021-12-29 03-29-46
Ricardo Figueiredo

Consuming actions from one module to another is creating side references.

Another thing is, list and records if needed to be stored, cant be stored in those client variables, any workaround? :)

2018-10-29 08-31-03
João Marques
 
MVP
Solution

When creating references, you should always take into account your architecture. Being that said, a side reference is not necessarily a violation, between core applications / modules for instance it is actually quite common. You should see if it makes sense on your architecture to have that side reference or to have a module in a level below.

Regarding the allowed value types in client variables, indeed lists and records are not allowed.

If you would be working on Mobile, I would suggest using Local Storage which is not allowed in Reactive applications.

As I see it, you only have two options to persist tables and records in a Reactive application:

  1. Save the record or data in a serialized JSON in a text Client Variable
    • Pros: Having data in client side means you don't need to go to server side to get this information which is better for performance. Besides it will work offline.
    • Cons: Having to serialize / de-serealize is a hassle which will increase the effort to maintain and to read the code
  2. Save the record in the database:
    • Pros: Persisting and reading this information is more transparent and of course the limits are way different than the client variable.
    • Cons: Performance-wise, there will be round-trips to server and to the database. It also does not work offline.


And of course, don't forget to avoid storing confidential information on client variables.


Kind Regards,
João

2021-12-29 03-29-46
Ricardo Figueiredo

Yes this is a reactive web app. This reply was the solution I was searching for! Thanks :)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.