OnParametersChange - Indicate which parameter change
4040
Views
8
Comments
New
Service Studio

It would be interesting if the action of OnparametersChange action indicate WHICH parameter has changed.

We often need to do different actions or refresh according to the updated parameter and this information would be very useful.

Hi Inês,

The typical thing to do is store a local copy inside the block of that particular input parameter you're interested in, and in the OnParametersChanged of the block, add an If node comparing the input value to the local value.  And of course after that, updating the local value with the input value.

Getting that information in some way from the platform rather than from your own logic, would take away the need to have a local variable and to keep that variable up to date, but you will still have that If.

In the meantime, if you have large blocks with lots of inputs, and you don't want to clutter up your OnParametersChanged action with all kinds of If's and assigns, and don't want to clutter up your blocks parameters with lots of local copies of parameters, here's a workaround :

You could defer the comparison and keeping local copy to a helper block, and avoid the If by having a having a handler in your block to handle only the change of that specific input variable.

Can't share an oml in ideas section, so not sure if I can explain properly :

In it's simplest form, you just have a helper block, let's call it ParameterChangeMonitor, that has a single input text variable, only an If False on the canvas, with something in the true to make it visible in SS, an OnParametersChanged action that launches a parameterless event.

In the block where you are for example interested in some code only happening if inputX changes, you put an instance of ParameterChangeMonitor in your block, pass inputX into it, and handle the event of that block in a handler called for example "inputXchanged"

You could give it more features, like having the event pass back old and new value and things like that.

Dorine

Hi, 

I like this idea. If we are going to distinguish wich parameter has changed, I'd like to have an atribute of a webblock input parameter, configuring if it triggers or not the onParameters Change Event

Merged this idea with 'Bind OnParametersChanged to a parameter' (created on 07 Mar 2023 11:00:59 by Sirajeddine Bouasker)

Hello everybody,

My idea is about Block event: OnParametersChanged.
To explain it let's consider the following scenario:
I have a block with 2 aggregates Aggregate1 and Aggregate2, and I have 2 parameters: Param1 and Param2, related to Aggregate1.Count and Aggregate2.Count respectively.
In the current implementation, every change on any aggregate, will trigger the OnParametersChanged event, so it will refresh both aggregates inside of it.
However, I want to only refresh the one updated.
In other words I want to have 2 OnParametersChanged events, the first bound to Param1 and Aggregate1, and the second bound to Param2 and Aggregate2.


Kind regards,
Sirajeddine

Good idea,

is not exactly same, but similar to this

Dorine

Hi @Dorine 

Thank you.

Yes it is similar. 

A boolean property on the parameter flagging if changed would simplfiy "many a" multiple webblock interaction triggering.