Why we create Local variables?

Hi, this is sateesh,

In this case, I don't want to know the definition. I want to know why and give me one proper example

Solution

Hi sateesh,  

I have added oml please check.

Thanks,

Vipin Yadav

FetchingDataExercise.oml

Solution

HI Sateesh,

We need local variables to hold some value temporally with in the action/screen/block... Because while writing logic sometime condition raise to store the value for some time so that we can use value later so we store it in local variable. 

As you asked it may be type of entity identifier. Lets say you have some action in that you need to perform few actions for a particular user. So in this case it will be useful if I store UserId in a local variable so can use it anywhere in the scope of that action.

The use of local variable is same in OutSystems as it works in other programming languages. For better understanding you can go through the links mentioned above by other community members.


Regards


Solution

Hey @TELUGU SATEESH ,

  • Local variables are used to store data at screen level. 
  • These stored values will be erase when page refresh  or navigate to other page.
  • These local variables are initiated to its default value at page initialize.
  • You can create local variables to the screens, client actions, server actions etc.,
  •  local variable is directly accessible inside the screen and the corresponding screen elements like client actions, data actions.
  • if the local variable is created inside the client actions inside the screen, that cannot be directly accessible by the screen.

Hope you will understand!

Thanks

Yogesh

Hi, Vipin Yadav,

I need one more example for a local variable like a dataType is an entity Identifier.

Solution

Hi sateesh,  

I have added oml please check.

Thanks,

Vipin Yadav

FetchingDataExercise.oml

Hi,

Local variable have scope within action. In that scope you can use it to store different types of value that outsystem provide.

Hello,

In his case , You need more explanation , In guided path, we have a video, here it is explained in detail

https://www.outsystems.com/training/lesson/1772/variables-in-outsystems?LearningPathId=2

I hope this helps.

Thanks & Regards

Tousif Khan

Solution

HI Sateesh,

We need local variables to hold some value temporally with in the action/screen/block... Because while writing logic sometime condition raise to store the value for some time so that we can use value later so we store it in local variable. 

As you asked it may be type of entity identifier. Lets say you have some action in that you need to perform few actions for a particular user. So in this case it will be useful if I store UserId in a local variable so can use it anywhere in the scope of that action.

The use of local variable is same in OutSystems as it works in other programming languages. For better understanding you can go through the links mentioned above by other community members.


Regards


Solution

Hey @TELUGU SATEESH ,

  • Local variables are used to store data at screen level. 
  • These stored values will be erase when page refresh  or navigate to other page.
  • These local variables are initiated to its default value at page initialize.
  • You can create local variables to the screens, client actions, server actions etc.,
  •  local variable is directly accessible inside the screen and the corresponding screen elements like client actions, data actions.
  • if the local variable is created inside the client actions inside the screen, that cannot be directly accessible by the screen.

Hope you will understand!

Thanks

Yogesh

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