148
Views
14
Comments
Screen Local Variable always get default value on screen action

Hi all, 

I have a screen local variable to stored list "sub-category" as JSON. 

I have trigger from "Sub-category" Web-block to return list JSON value and on event handler I assign to screen local variable.

I used feedback message to show value of local variable in Event Handler and it showed correct value.

But when i click on Save button, the value of local variable is blank (default value).

How can i get correct value in Save action?

Please help!

2021-06-01 05-56-33
Komal Kumbhar

Hi Hung,

Are you able to share the screen shot of the action and assignment,

Also check the method of an action of button.

Kind Regards,

UserImage.jpg
Hung Nguyen

Hi Komal,

here is my actions

2021-06-01 05-56-33
Komal Kumbhar

Hi Hung,

Here you said  "I have a screen local variable to stored list "sub-category" as JSON. ", what is data type of your local variable?


UserImage.jpg
Hung Nguyen

as screen shot. The local variable is "VarTypeOfRMTableAsJSON" with Text data type.

UserImage.jpg
Hung Nguyen

I tried add Expression to show local variable to screen and using Ajax to refresh it after assign.

It worked. I can get correct value in Save action.

Can you tell me why?

2021-06-01 05-56-33
Komal Kumbhar

I have implemented same thing, you can check here, https://komal-k.outsystemscloud.com/Block_Event/DisplayJSON.aspx click on get value, you will get the value which block has sent to screen then click on save will return the same value 

Kind Regards,


BlockEvent.oml
UserImage.jpg
Hung Nguyen

Hi Komal. 

I updated this oml to use editable table then it's not working as expected.

https://hung-nguyen15.outsystemscloud.com/Block_Event/DisplayJSON.aspx

The oml here!

BlockEvent.oml
2021-06-01 05-56-33
Komal Kumbhar

So you want,  

1. Add record in editable table in block, 

2. Click on correct tick

3. Event called and JSON valued saved into Screen's local variable

4. Click on Save - value should be there for some operation

Is this correct?

2021-06-01 05-56-33
Komal Kumbhar

Check the attached OML if that works for you,


BlockEvent.oml
2021-06-01 05-56-33
Komal Kumbhar

Hey Hung,

Does that meet your requirement ?

UserImage.jpg
Hung Nguyen

I checked on yours environment but it didn't work.

So i added an expression to stored local variable on view state.

Thanks!

2021-06-01 05-56-33
Komal Kumbhar

Share the clear solution so any one stuck at same will get it from here.

Kind Regards,

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