187
Views
9
Comments
Solved
Edit form with variable in input

Hello,

I have a form where some of the inputs are tied to a local variable so that I can perform some calculations with it. After submitting the form the values are saved as I assigned the value of the local variable to the attribute itself. However, when going back to edit the form, those inputs that are tied to a local variable shows up as empty, understandably as they are local variables then exist in the screen only. Is there a way where I can continue to use local variables for the variable in the input but at the same time get the value when I edit the form again? Thank you!



2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi,

If those values are exactly the same as what you save into a database field, I would say, don't do the extra work but just bind the aggregate result field to the variable.

If for some reason you can't, you'll have to add an OnAfterFetch event to the aggregate or dataAction, and use an Assign in there for your local variable.

Dorine

UserImage.jpg
Low Nico

Hello Dorine,

Thank you for your help, I did indeed do extra work and made something that is simple complicated. 

2022-12-09 04-50-17
Shubham Doshi
Solution

If you want to make the values persistent even after the user logged out. Then you have to bind the inputs to the aggregate.

2022-12-09 04-50-17
Shubham Doshi

Hello Low,

You can use client variables to store data until the user session ends. This will help you to store values in variable while navigating between screens

UserImage.jpg
Low Nico

Hello,

Thank you for your suggestion! But for client variable, when the users log out and then log back in, the value will be gone too right? So it wont be a good user experience

2022-12-09 04-50-17
Shubham Doshi
Solution

If you want to make the values persistent even after the user logged out. Then you have to bind the inputs to the aggregate.

UserImage.jpg
Low Nico

Hello,

I managed to solved this issue, thank you for your help on this!

2022-12-12 06-07-07
Dhivyaraj Sivam

Hi Low,

To say it short Client variables are to the front end (browser) what session variables are to the server.

You cannot access session variables directly in screen actions or client actions of reactive web applications.

You would need to write a server action and use that in a Data action on your screen.

Client variables are stored in locally in the browser.


Regards,

Dhivyaraj Sivam

UserImage.jpg
Low Nico

Hello,

Thank you for your suggestion!

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi,

If those values are exactly the same as what you save into a database field, I would say, don't do the extra work but just bind the aggregate result field to the variable.

If for some reason you can't, you'll have to add an OnAfterFetch event to the aggregate or dataAction, and use an Assign in there for your local variable.

Dorine

UserImage.jpg
Low Nico

Hello Dorine,

Thank you for your help, I did indeed do extra work and made something that is simple complicated. 

2025-04-17 05-42-16
Ajit Kurane

Hi Low,

You need to bind local variable values to the aggregate. It will make your work much easier.

For better solution if you share sample oml that would be great to have a look.

Thanks.


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