Hi everyone!
I have a popup that contains multiple blocks. One of these blocks (the target block) needs to know whether any other block inside the popup is dirty. I tried using events in each block to notify the popup when a block becomes dirty, and then passing this information to the target block through Input Parameters.
However, I ran into a problem. The target block has an OnParametersChanged client action that refreshes its aggregates. When the aggregates refresh, they update some local variables - but this should not happen when only the IsDirty input parameter changes.
My goal is to let one block inside the popup know if any other block in the same popup is dirty, without triggering an aggregates refresh.
What would be the best solution to this problem?
If I understand correctly, let summarize your case as below:
My first solution is easy but not clean and general. You can do these amendments in block A
For some additional purpose, can change the logic of OnAfterFetched and OnParameterChanged to let it refresh the data.
Second solution is cleaner one:
Hi @Łukasz Kaproń ,
Your target block has several inputs, some are indicators if other blocks are dirty, some are inputs that the blocks aggregates are based on, right ?
The simple approach is to make a local copy in targetblock of the input(s) that should trigger a refresh, and in OnParametersChanged check if local(s) <> input(s), in that case refresh aggregate and copy to local.
I have written an article if this simple approach leads to too ugly logic, but if you only have to make a simple decision, to refresh or not to refresh, that would probably be overdone. If you have a complex block landscape, and don't want to have to pass around states from one child to another through a parent, you could look at the end of that article, the change locale example.
Dorine
Hi,
If I understand correctly, you’re retrieving the IsDirty value in the target block, but that action is triggering a refresh of the aggregate which you want to avoid.
If the goal is simply to prevent the aggregate from refreshing when IsDirty is true, you can add an If condition OnParameterChanged. When IsDirty is true, the logic will follow the alternative path and the aggregate will not be refreshed.
Hope this helps.
Regards,
Vignesh
Simply checking on IfDirty = true will probably not cut it. Once it becomes true, any future changes on the input that should trigger a refresh, won't.
@Łukasz Kaproń : You can apply the same solution discussed at https://www.outsystems.com/forums/discussion/105669/trigger-a-child-block-action/#Post464284 here as well. You need to expose a method from the target block and when the popup receives events from the other blocks you invoke the exposed method. This way you will not refresh the aggregate.