82
Views
3
Comments
Solved
OnParametersChanged not triggered on nested block
Question
Application Type
Reactive
Service Studio Version
11.54.11 (Build 62451)

Hi All,

I'm facing an issue with OnParametersChanged event is not triggered despite the value of the parameter has been changed.

  • The blocks' hierarchy is as follows: A screen contains a Button (Get Age) it passes the name to Block A. 
  • Block A contains Blocks B in popup. OnParameterChanged of Block A gets triggered and based on condition I'm defining an Age and opens the popup with boolean variable.
  • Block B OnParameterChanged is not getting triggered to even after the age is passed to Block B.
  • Block B OnParameterChanged has a variable assignment to store age in local variable of Block B.

To reproduce this behaviour I've created an OML for reference.

Note: If is use direct input parameter of Block B in expression the age is getting displayed, but I have a use case to modify some data with OnParametersChanged of Block B.

Regards,

Vinod

BlockTest.oml
2018-08-27 08-29-35
Fábio Vaz
Solution

Hello,

Leave here an solution:

BlockTest.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi @Vinod Kumar R ,

it is correct that in your example, the OnParametersChanged is not triggered.  This event only happens on an existing block, and your block B doesn't exist until after the Popup is displayed.

So, the fix of Fabio is avoiding this problem, by postponing the change with a delay until after the block is added by opening the popup.

In this type of situation, I prefer to create a block action isolating whatever logic i would like to happen, and call that action both in the OnReady and in the OnParametersChanged.

If your block B is also being displayed as part of a popup, you could also move the popup inside the block, then you probably would get away with leaving your logic only in your OnParametersChanged.

Dorine

2018-08-27 08-29-35
Fábio Vaz
Solution

Hello,

Leave here an solution:

BlockTest.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi @Vinod Kumar R ,

it is correct that in your example, the OnParametersChanged is not triggered.  This event only happens on an existing block, and your block B doesn't exist until after the Popup is displayed.

So, the fix of Fabio is avoiding this problem, by postponing the change with a delay until after the block is added by opening the popup.

In this type of situation, I prefer to create a block action isolating whatever logic i would like to happen, and call that action both in the OnReady and in the OnParametersChanged.

If your block B is also being displayed as part of a popup, you could also move the popup inside the block, then you probably would get away with leaving your logic only in your OnParametersChanged.

Dorine

2023-03-08 10-32-19
Vinod Kumar R

Thanks @Fábio Vaz and @Dorine Boudry.


Both the soutions works here.

I will implement the solution based on the usecase.

Regards,

Vinod 

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