13
Views
5
Comments
Solved
Passing a value two blocks up using events
Application Type
Reactive

Hello everyone!

So i have a main screen where i use two blocks: A 'Header' block and a 'Content' block. Inside the content block, it uses another block as a list item. 

In this 'last layer' list item block, there is a value that is saved using the OnChange event action. And, considering it's in a list, there's an array of values. I add up all these values present in the list into a Total Value variable. And i want to use this Total Value in the Header block.

Here's a way to visualize it better in layers:

So, i use an Event in the ListItemBlock to send TotalValue to ContentBlock, and then, in the EventHandler in Content Block, i save the value that is brought by the event in a local variable, and i I call a NEW Event to pass this value (TotalValue) up to the Screen. 


In Screen i also use the handler save the value from the Event in a local variable. And pass this value to Header Block as an input parameter.

My problem is: Up to Content block, the TotalValue is sent correctly. But when i use the second Event (SendTotal), it is passed as 0 everytime. Am i doing something wrong? How can i achieve this 'double layer event' usage?

I hope i was clear. 

Thank you.

Rank: #128
Solution

Hi Ines,

see attached OML for comparison.

As Carlos is saying, on your content block, if all you need to do is pass the total value on, you can just trigger event to handle the list block event rather than have an action to trigger the event.

Dorine

rwDemoDataOverBlocks.oml

Rank: #186
Solution

Hi Ines, can you upload the oml?

Did you debug and the value is saved on your local variable? do you need to save on local variable?(you can pass directly to the event inside the flow).

Usually this happening cuz the developer didnt do the match of the event item on the block level (I mean when you choose the event handler) and just do the assign inside the action flow, check if it is that the problem.


Hope I could help you

Cheers,

Carlos Lessa

Rank: #128

Hi Ines,

Looks all right what you are trying to do.

it sounds to me that you should be able to see what is going on by debugging the content block event handler.

Dorine

Rank: #186
Solution

Hi Ines, can you upload the oml?

Did you debug and the value is saved on your local variable? do you need to save on local variable?(you can pass directly to the event inside the flow).

Usually this happening cuz the developer didnt do the match of the event item on the block level (I mean when you choose the event handler) and just do the assign inside the action flow, check if it is that the problem.


Hope I could help you

Cheers,

Carlos Lessa

Rank: #128
Solution

Hi Ines,

see attached OML for comparison.

As Carlos is saying, on your content block, if all you need to do is pass the total value on, you can just trigger event to handle the list block event rather than have an action to trigger the event.

Dorine

rwDemoDataOverBlocks.oml