Hi everyone! 👋
I'm working on a web app and I have a local variable (Structure List) that stores some data. I want to refresh or update this data when something changes (like after an API call or user action) — but I don't want to refresh or reload the whole page.
Is there a way to do this in OutSystems?
✅ What I’m trying to achieve:
I already have data stored in a local variable
I just want to reload or update that variable
Without doing a full screen refresh or navigation
Thanks in advance! 🙏
Hi @jesu verso,
You can use either the ListClear client action or the ListClear server action. These actions can be applied before assigning the new values to the List structure.
"These actions can be applied before assigning the new values to the List structure. " didnt know about this can you explain more this pls?
Hi @jesu verso
Yes, you can achieve that without refreshing full page.
There's multiple ways depending on you use case.
You can directly assign values using Assign element after the call. in case you want to change specific recode of the list, make sure you have its index.
Also, if you want to add new element to the existing structure list. Can use append.
These will update your list without refresh.
Hope this will help you!
what if i want to clear it and put and insert new data but same entity?
You can directly assign a new data to the local variable using either the Aggregate, Data action, or API call.
Can make use of clear and append all.
Clear to clear the existing local list data.
Append all to add all data of the aggregate or api call.
I TRIED this in data action and aggreagate and it does not owrk maybe im using it wrong
hi sir @Sakthivel P i am not using an api sorry for the confusion, i am using only aggregate and data ation
If you are using Data action you have output from the action you can clear that Output list and assign new data that local variable or if you are using Aggregate you can use OnAfterFetch to that aggregate in the OnAfterFetch action you can clear and add new value to that local variable.
if you still confused share me the OML. Let me update and share it to you back.
still confused on the part on the onafterfetch sir.. sorry
here it is sir my plan is when i click the points that is displayed will changed,
If you want to refresh the data-source (aggregate or data-action), you can just drag and drop it in the flow of the activity on which you want to refresh it. After refreshing the source you just need to reset the variables which are holding the output result of aggregate/data-action. After resetting the variables, you need to set the values to the variables again.
To set the values again to the variables, you can use onAfterFetch actions or you can do it just after the call of these data-sources, here you need to make sure that the data-sources are executed before assigning values to the variables.
sorry for late reply sir thank you for replying and may i ask sir if do you have any example oml on this? thank you sir