When i pass a list from a screen to a block and then add items to the list from the block it should change the list also for the screen because its a refrence ?
Can you explain it with more details?
What exactly are you expecting?
Regards,
Prakhar Sharma
i got an empty list in my screen , i pass the list as an input to a block , inside the block i append the list with a new item , inside the block the list did appended but somehow it didnt change the original list from the screen. so i want to know how can i pass a list and make changes from the block to the original list
It will not automatically change on the screen.
Once you update the list in the block, you will need to send back the list from the block to the screen using an Event and then in the handler of the event, you will need to assign the event list with the local list on the screen.
Kind of back and forth.
Hi @yuval twina
take help from the OML. i am attaching below.
sample - Sample
mark my reply as solution if you find it appropriate.
Thanks
Prince
Hey @yuval twina ,
When appending new records in a block to your list, that lives inside its parent, follow these steps:
Check oml
No, if you change the list in the block, the list in the screen won't change. For this you will need to use an event. You can then pass the list from the block to the event, after which the event handler can use this to update the original list in the screen.
Edit: André Costa beat me to it, and with a more elaborate explanation as well.
Hi,This is the official way of passing data between blocks.
https://success.outsystems.com/documentation/11/developing_an_application/design_ui/reuse_ui/pass_data_between_blocks/
Passing by reference, to my knowledge is not available client side, and is only is done in two occasions server side
Daniel
In order to verify passing parameters by reference I tested this in O11 Reactive:
But also in this case the list is passed by value.
Test scenario:
Server action 1
Server action 2 (in the same module):
After that, when returning to server action 1, the aggregate list hasn't changed.
I have never found a scenario in O11 Reactive where a list was passed by reference.I would like to have that in order to split very long server actions, manipulating a record list, into smaller ones, passing the record list by reference, without having to copy the list and returning an updated version.
Hi @yuval twina ,
My question is that when list is always empty then why are you passing it from parent screen to web block.
At the end you are appending values in list inside block then no need to use input parameter just convert it in local variable and as above suggested by other members use event handler to show this list on parent screen.
Best
Arun
I agree
While interact(sharing values) from scree to the block, we will use input parameter.
Likewise, from block to screen , we will use event to pass values.
I believe , Your case is second one. You have to use event while appending values in the list and create a handler in the screen that will get your desired value and you need to store in another variable.
Hope it helps.
Mohan