dataform
dataform copied to clipboard
Bug with SQL template variables when action inside while loop
When iterating an operation over the months I'm using while
loop and a dynamic date variable in the SQL template.
I see something strange happens to the iterator variable within the SQL template.
Example:
let i = 0;
while (i <= 1) {
operate(`while ${i}`).queries(ctx => `
SELECT '${i}' AS value
`);
i++;
}
I get the following compiled SQLs:
- Operation "while 0"
SELECT '2' AS value
- Operation "while 1"
SELECT '2' AS value
-
forEach
andfor
loops work OK, - without
ctx =>
it works OK too.
Originally reported here: https://issuetracker.google.com/issues/365808530