Select to view content in your preferred language

Summary Section, Where doesn't work with Query to Field, Get "cannot be found in the current parsing scope"

184
4
Jump to solution
Friday
Carrie2025
Emerging Contributor

Hello - I am putting together a report where I am trying to pull a list of all previous inspections in a summary report.  the inspections table is linked as a related table using a GUID Field (In my report, called PERM_ID).  From what I read, this should be possible.  However, I keep getting a "Cannot be found in current parsing scope" error.  I know the "PERM_ID" field is correct, it works in other places, as well as in the summary section when not used in as part of the where clause.

It works if I hardcode the value in in - it works if I don't use a where statement, and according to documentation, It should work.

I'm not sure what I'm missing - I've uploaded the report I'm using (Its currently missing the !important to pull all matching value)

 

0 Kudos
1 Solution

Accepted Solutions
Neal_t_k
MVP Regular Contributor

This might be worth a shot, not sure if it will work in the sql.

https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereport-repeats.htm

${#PermitInspections_test|where: "PERM_ID ='${<mainlayername>.PERM_ID}'"}

or

${#PermitInspections_test|where: "PERM_ID ='"+${<mainlayername>.PERM_ID}+"'"}

View solution in original post

0 Kudos
4 Replies
VenkataKondepati
Regular Contributor

This is a report parsing-scope issue, not a bad field.

In Survey123 reports, the where: clause on a related table runs in the child table’s scope, so the parent field (PERM_ID) isn’t automatically visible. That’s why it works when hardcoded but fails when referenced.

Fix: reference the parent explicitly (or assign it first):

${Inspections | where:"perm_id='${@parent.PERM_ID}'"}

(or assign PERM_ID to a variable and use that).

Related-table queries can’t “see” parent fields unless you explicitly pass them into scope.

Regards,
Venkat
Neal_t_k
MVP Regular Contributor

This might be worth a shot, not sure if it will work in the sql.

https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereport-repeats.htm

${#PermitInspections_test|where: "PERM_ID ='${<mainlayername>.PERM_ID}'"}

or

${#PermitInspections_test|where: "PERM_ID ='"+${<mainlayername>.PERM_ID}+"'"}

0 Kudos
Carrie2025
Emerging Contributor

Hello There! Thank you so much for your help - I ended up using partially @Neal_t_k solution, but @VenkataKondepati pointed me in the correct direction and gave me the piece that I was missing.  I ultimately went with this:  ${#PermitInspections_test| where:"PERM_ID = '"+$mainlayer.PERM_ID+"' !important" |orderByFields: “OBJECTID DESC”}, inside a table, and it works.  Now, I just need to wait on my user to tell me exactly what he wants in this report!   Thank you so much for your help! 

VenkataKondepati
Regular Contributor

Thanks for the comments @Carrie2025 . I am glad it worked out.

Regards,
Venkat