On the first click, we get nothing back. On the second click, we get an object with the result from the previous query, although the result of the query is correct:
You don't (can't) use await AND .then, they are 2 different ways of handling promises. Personally, I prefer await, so you'd modify your code like this:
@MikeCB thanks for the quick reply!
i understand and changed it.
But it seems that isnt the solution for this problem.
We have found out by trial and error that the object we are forming is quite correct. But when assigning this object to a state via "setValue", this value is not accepted.
I give it out on the console, with this code:
console.log(best); // the original object
console.log(xCreateDeliveryNote.value); //the state before the assigning
xCreateDeliveryNote.setValue(best); // the assignment
console.log(xCreateDeliveryNote.value); //the state after the assigning
Thanks for the hint. But we use the console in the debug-window.
The option "Keep variables in sync" is only available for JS query, not for SQL query.
Did you run all of those console logs at the same time? It could be that the last one runs before the variable is updated if so. If you open the variable in the debug menu and look at value, is it correct or still the original state?