Delay query binding execution until all parameters have updated?

I have a table populated from a query binding. Two of the parameters being passed to the query are pulled from properties that are generated from their own bindings. One of those properties' binding is dependent on the value of the other one. It appears that a change in the value of any of the query's parameters will cause it to re-evaluate, which makes sense. But due to the one value being dependent on the other, this means that a change in the first causes the query to execute, and then it gets executed again as soon as the second value changes. So how would one go about making sure the query doesn't execute until that second property has updated based on the change in the first?

Use an expression structure binding (or my asMap() and transform() expression functions) to generate those values in a single binding. Then point the NQ binding at that object's inner elements.

With my Integration Toolkit, do something like this:

transform(
	....., // First expression
	asMap(
		'firstKey', value(),
		'secondKey', ..... // Second expression, with value() where needed for the first result
	)
)
2 Likes

I put the two values into a single object that is updated by an expression structure binding (with "Wait On All" checked). I put a debug print in a change script on that object to verify that it is only changing once. Yet, the query is executing twice...

TestQueryBinding_2024-07-12_1721.zip (32.6 KB)
I created this very simple project to demonstrate the problem. Toggling a checkbox causes an Expression Structure binding to update two values in a single object, which are passed as parameters to a Query binding. Debug prints show the change in the object followed by two invocations of a script transform applied to the query:
image

Hmm. Not what I expected. Might not be able to use a query binding for your case.

Consider using a property binding to the outer object, and running the NQ from a script transform attached to that. The script would pass the outer object as the NQ's parameters dictionary, if you take care to match up the expected keys.

I tried that, and it seems to work...until it doesn't. Sometimes the expression structure gets executed twice...
image
Seems like a bug...

(This is all on 8.1.36)

I will admit to never using expression structure bindings, as my asMap() can create such arbitrary objects, and can use dynamic keys. Consider trying my Integration Toolkit's expression functions to build your object, before handing it to your script transform.

3 Likes