If I have nested start expressions in a template, does the THISROW expression change to the the row selected in the start expression once it hasn’t reached the END expression or does it always refer to the row that triggered the template?
For example in the below, does the _THISROW in the second start expression refer to “ProjectDetails” row selected or the same row that the _THISROW in the first start statement points?
<<Start: Filter("ProjectDetails", [StartDate] > [_THISROW].[Date])>>
........
<<Start: Filter("ProjectActivities", [ProjectID#] = [_THISROW].[Project Name])>>
........
<<End>>
<<End>>
Hello @Cathal_Noone, first let me show you the best explanation there is for [_THISROW], it applies to both regular expressions and workflows.
[FAQ: FILTER(), LOOKUP(), MAXROW(), MINROW(), REF_ROWS(), and SELECT()](https://community.appsheet.com/t/faq-filter-lookup-maxrow-minrow-ref-rows-and-select/24216/43) Tips & Tricks ?
Back-references within nested queries ([_THISROW-n]) Consider a complex App formula with “nested” SELECT() expressions (SELECT() expressions within SELECT() expressions): SELECT( table[column1], … SELECT( table[column2], … SELECT( table[column3], … ) … ) … ) Let’s call the row for which this entire expression is evaluated as its App formula the Origin Row. Within this entire expression, we can refer to column values of the Origin Row by dere…
By looking at the masterfully explained diagram, we can see that [_THISROW] is always going to refer to the origin row.
4 Likes
Thanks a million @Rafael_ANEIC-PY, that is exactly what I was looking for.
2 Likes
I’m facing the same and I know I could resolve by introducing a new VC that can be consumed by the nested Start but I would rather avoid that if possible.
So I’m curious how you solved this problem?
1 Like
If you have a look at Rafaels post the solution is in the attached FAQ. Essentially, use [_THISROW-1] to go up one level to the previous start, [_THISROW-2] to go up 2 levels, etc…
2 Likes
Ah, I didn’t quite gather that’s what you needed. I have a different need. I’ll continue searching and open a Question if I can’t find the answer. Thank you for the response.
For some strange reason, my problem was solved by using [_THISROW-1]. Let me explain my scenario:
I was looking for getting a running total in my email template and I didn’t want to use Virtual Columns for getting running totals as it cripples the loading time. My data was sorted in reverse chronological order, hence all I had to do is to filter the rows that are before the current row and take the sum. I was frustrated with [_THISROW] and after reading this post I realized that it is not going to work. I expermented with [_THISROW-1] and it gave me the desired result.
1 Like