Just came across this issue in an Excel template and seemingly there was reports about this same issue in early 2023 and late 2023 - early 2024. I am using the following expression in my template and it appears that [_THISROW] is not properly applied:
Note that [MeterInformation_fk] is a column in both tables in this case, which is why [_THISROW] is an important factor in the expression. If I add the same expression into a VC in my table and just use the VC in my template then this works out fine. But, I really only need this calculation in the template, so using a VC adds unnecessary calculation time in the app.
It appears that in the context I am using it does not apply any of the filters in the AND() expression, however I am using the same expression in the VC where it is correctly evaluated. See screenshot below of my template:
Note that I removed one of the [_THISROW] references in the AND(). If I use the expression in my initial post the result is 39,000,000. I am very certain that it is because of the _THISROW factor and the 39 million result probably is the sum total of that table column for all 300,000+ rows.
Seemingly this is the solution, although I am not certain why. I presume because my <> expression is essentially my main query, therefore the SELECT() expression becomes a nested query. I think what I am missing is why is it treated as a nested query in the template, but not in the VC expression?
The “main query” is actually above/outside the <>…<> tags. If the bot is running against a row (triggered by an add, update, or delete), [_THISROW] refers to that row. If the bot is scheduled, I’m not sure it refers to anything; it may be undefined and silently ignored.