305
Views
6
Comments
Solved
What is the difference between client variable and simple variable?
Question

I just want to know the basic difference between client variable and local variable.

If client variable is good enough then why we need to use local variable. Can anyone suggest me.

Hi Priyanka,

The main difference is you can access the client variable anywhere in the application. like global variable inside the module.

Also you can change the value of it and can access from anywhere in the module.

But for Local variable has the scope in which it is defined. This is only for temporary purpose in the action flow.

Local variable can release the memory when it left the scope. (this is the advantage)

Regards,
Manish K


Manish Kumawat wrote:

Hi Priyanka,

The main difference is you can access the client variable anywhere in the application. like global variable inside the module.

Also you can change the value of it and can access from anywhere in the module.

But for Local variable has the scope in which it is defined. This is only for temporary purpose in the action flow.

Local variable can release the memory when it left the scope. (this is the advantage)

Regards,
Manish K


Thanks Manish.


mvp_badge
MVP

Hi, 

Client variables are Persistent, and are kept client side, between sessions. They can even be shared between applications of the same environment and browser. 

They also have a broader scope, so they are visible on any place inside the module. 

This means that you shouldn't use it indiscriminately, as you will lose one of the important aspects of programing, that is isolation. 

Só, if you need this capabilities, use a Client variable. Otherwise, use local variables. 

Cheers 

Hi Priyanka,


Client variables just stores basic data types and are used in the reactive and mobile context:

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Data/Handling_Data/Client_Variable


You can see in this link in detail what is the client variables context and verify the differences.


Hope this can help you.


Best regards,

Ricardo M Pereira

mvp_badge
MVP

Hi Priyanka,

You can read more about what Client Variables can be used for. They persist on the client-side, even if you change screens.

Local Variables only exist within the context of the screen/action/block they were defined in.

Hope this helps

Hi Priyanka,

The main difference is you can access the client variable anywhere in the application. like global variable inside the module.

Also you can change the value of it and can access from anywhere in the module.

But for Local variable has the scope in which it is defined. This is only for temporary purpose in the action flow.

Local variable can release the memory when it left the scope. (this is the advantage)

Regards,
Manish K


Manish Kumawat wrote:

Hi Priyanka,

The main difference is you can access the client variable anywhere in the application. like global variable inside the module.

Also you can change the value of it and can access from anywhere in the module.

But for Local variable has the scope in which it is defined. This is only for temporary purpose in the action flow.

Local variable can release the memory when it left the scope. (this is the advantage)

Regards,
Manish K


Thanks Manish.


Client variable defined as basic data type or data identifier while local variable can be any data type like identifier, record, structure, list etc. 


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