Hi,
Please could someone give me a hand understanding a circular definition issue.
Iโve created a VC helper-column called [FINDMAXROW] to house an expression that I need to re-use several times an Initial Value in a form.
[FINDMAXROW]
IF(
[survey_type] = "Node",
MAX(
SELECT(
survey[_ROWNUMBER],
AND(
[survey_type] = "Node",
[_THISROW].[LCS] = [lcs],
[_THISROW].[select_cabinet_to_survey] = [select_cabinet_to_survey],
[_THISROW].[select_asset_type] = [select_asset_type],
NOT([branch_info] = "new branch")
))),
IF(
[survey_type] = "Cable",
MAX(
SELECT(
survey[_ROWNUMBER],
AND(
[survey_type] = "Cable",
[_THISROW].[LCS] = [lcs],
[_THISROW].[select_cabinet_to_survey] = [select_cabinet_to_survey],
[_THISROW].[select_asset_type] = [select_asset_type],
NOT([branch_info] = "new branch")
))),
""
))
.
.
Testing [FindMaxRow] VC in the Expression Assistant yields the correct result and shows max row 2 for โnodeโ and max row 12 for โcableโ
LOOKUP([_THISROW].[FINDMAXROW],"survey","_ROWNUMBER","survey_type")
.
Testing [survey_type] Initial Value in the Expression Assistant yields the correct result and shows โnodeโ and โcableโ in the right places
Hereโs the survey table if it helps:
Solved! Go to Solution.
[_THISROW].
[_THISROW].
is used inside SELECT()
or FILTER()
expressions to reference back outside of the SELECT/FILTER.
But LOOKUP()
's first parameter is in the same context as the table already, so you can reference it directly.
LOOKUP([FINDMAXROW],"survey","_ROWNUMBER","survey_type")
Iโm not sure if this is the only issue though. This seems like separate cause. But then you did have 3 errors to start with, soโฆ
Hi @GreenFlux,
Thanks for sharing the postโฆ
I donโt have any Reset_On_Edit conditions.
I had a few EditableIf conditions which I have now removed but the issue stands.
My first thoughts were that I may be using the [_THISROW] incorectly somewhereโฆ?
Still investigatingโฆ Cheersโฆ
I am sure there will be better guidance than this.
However it sounds that you are using the column type [Survey_Type] in computing FINDMAXROW expression and you are in turn using that MAXROW in LOOKUP () to again return the [Survey_Type] and then using the output as initial value in the same column [Survey_Type]
So it sounds that the same column is used to compute its own value. I believe that constitutes a circular reference?
Also since the [Survey_Type] is used in the expression FINDMAXROW expression , I believe it will always match the [Survey_Type] for that row even in expression assistant.
Hi @Suvrutt_Gurjar,
Thanks for thatโฆ I have binned the [FINDMAXROW] VC expression and am back to just using the Initial Value expression in the [survey_type] column as below but I still get the error - though only two and not three this timeโฆ
IF(
[survey_type] = "Node",
LOOKUP(
MAX(
SELECT(
survey[_ROWNUMBER],
AND(
[survey_type] = "Node",
[_THISROW].[LCS] = [lcs],
[_THISROW].[select_cabinet_to_survey] = [select_cabinet_to_survey],
[_THISROW].[select_asset_type] = [select_asset_type],
NOT([branch_info] = "new branch")
))),
"survey","_ROWNUMBER","survey_type"
),
IF(
[survey_type] = "Cable",
LOOKUP(
MAX(
SELECT(
survey[_ROWNUMBER],
AND(
[survey_type] = "Cable",
[_THISROW].[LCS] = [lcs],
[_THISROW].[select_cabinet_to_survey] = [select_cabinet_to_survey],
[_THISROW].[select_asset_type] = [select_asset_type],
NOT([branch_info] = "new branch")
))),
"survey","_ROWNUMBER","survey_type"
),
""
))
.
I found that the two offending lines were:
.
[_THISROW].[select_cabinet_to_survey] = [select_cabinet_to_survey],
[_THISROW].[select_asset_type] = [select_asset_type],
.
Removing them and running the expression like this makes the error go away:
.
IF(
[survey_type] = "Node",
LOOKUP(
MAX(
SELECT(
survey[_ROWNUMBER],
AND(
[survey_type] = "Node",
[_THISROW].[LCS] = [lcs],
NOT([branch_info] = "new branch")
))),
"survey","_ROWNUMBER","survey_type"
),
IF(
[survey_type] = "Cable",
LOOKUP(
MAX(
SELECT(
survey[_ROWNUMBER],
AND(
[survey_type] = "Cable",
[_THISROW].[LCS] = [lcs],
NOT([branch_info] = "new branch")
))),
"survey","_ROWNUMBER","survey_type"
),
""
))
.
Still investigatingโฆ
[_THISROW].
[_THISROW].
is used inside SELECT()
or FILTER()
expressions to reference back outside of the SELECT/FILTER.
But LOOKUP()
's first parameter is in the same context as the table already, so you can reference it directly.
LOOKUP([FINDMAXROW],"survey","_ROWNUMBER","survey_type")
Iโm not sure if this is the only issue though. This seems like separate cause. But then you did have 3 errors to start with, soโฆ
Hi @GreenFlux,
I removed every instance of [_THISROW] and the errors have gone!
A quick check also looks like the expression still produces the desired result.
I kind of get what you said about the SELECT() referencing back outside and LOOKUP() being in the same context as the tableโฆ So it would be right to use [_THISROW] in SELECT() but it isnโt needed in a LOOKUP()/SELECT() comboโฆ? Iโll chew on that for a while and itโll make sense later Iโm sureโฆ
I looked but couldnโt find an AppSheet doc on [_THISROW]โฆ
Many thanks for your guidanceโฆ! Iโm up and running againโฆ! Cheersโฆ
User | Count |
---|---|
16 | |
11 | |
9 | |
8 | |
4 |