Is it "if" or is it "select" or "filter"????

2195
13
Jump to solution
01-28-2021 10:18 AM
LanceEber
New Contributor II

Hello All,

First post.

I've got a short survey.  Primary question is "Watch Report Item".  It is either "Significant Case" or "Patrol Check".  I've built a Word Template.  I've got a table for Significant Cases and a separate table for Patrol Checks. The tables are within the SUMMARY section.  How can I get the top table to just show "Significant Cases" and the bottom table to show just the "Patrol Checks"?

I've tried all of these options:

${watch_report_item | getValue:""}

${if watch_report_item | selected:"Significant_Case"} ... ${/}

${watch_report_item | checked:"Significant_Case"}

but get this error most of the time:

Error: An error occurred when checking the report template. Failed to parse ${if watch_report_item == “Significant_Case”} since field name or parameter watch_report_item cannot be found in the current parsing scope.

I've also tried this "if" statement: ${if watch_report_item == “Significant_Case”} 

Here is my current set up within the table:

SIGNIFICANT CASES

 

${#survey|orderByFields:"case_ DESC"}${watch_report_item}

${case_}, ${time_of_incident}, ${incident_type}, ${location_checked}

${narrative}${/}

 

PATROL CHECKS

 

${#survey|orderByFields:"case_ DESC"}${watch_report_item}

${case_}, ${time_of_incident}, ${location_checked}, ${narrative}${/}

 

Your help would be greatly appreciated.  I've tinkered around with it for hours with no luck.  This final "fix" will make my report just what I need.

Thank you,

Lance in California @ Merced Police Department

0 Kudos
2 Solutions

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

Hi Lance. I think you may want to use syntax along these lines:

IsmaelChivite_0-1611860199161.png

 

In your case, the expression could look more like:

${#survey | where: "watch_report_item = 'Significant_Case' " | orderByFields:"time_of_incident DESC"}${case_}, ${time_of_incident}, ${incident_type}, ${location_checked} ${narrative}${/}

Also attaching a modified template here for your reference.

 

It is important that you keep the quotes straight. For example: simple quote: ' and double quote ".  Microsoft Word has a tendency to create 'smart quotes' and they generate errors in the Survey123 report engine. Check this: https://support.microsoft.com/en-us/office/smart-quotes-in-word-702fc92e-b723-4e3d-b2cc-71dedaf2f343

 

It is hard to figure out the exact syntax without the reference help for your survey but I am hoping this gives you some clues. There are some additional details about summary sections in here: https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-summary-sections-i...

View solution in original post

IsmaelChivite
Esri Notable Contributor
0 Kudos
13 Replies
IsmaelChivite
Esri Notable Contributor

Hi Lance. I think you may want to use syntax along these lines:

IsmaelChivite_0-1611860199161.png

 

In your case, the expression could look more like:

${#survey | where: "watch_report_item = 'Significant_Case' " | orderByFields:"time_of_incident DESC"}${case_}, ${time_of_incident}, ${incident_type}, ${location_checked} ${narrative}${/}

Also attaching a modified template here for your reference.

 

It is important that you keep the quotes straight. For example: simple quote: ' and double quote ".  Microsoft Word has a tendency to create 'smart quotes' and they generate errors in the Survey123 report engine. Check this: https://support.microsoft.com/en-us/office/smart-quotes-in-word-702fc92e-b723-4e3d-b2cc-71dedaf2f343

 

It is hard to figure out the exact syntax without the reference help for your survey but I am hoping this gives you some clues. There are some additional details about summary sections in here: https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-summary-sections-i...

LanceEber
New Contributor II
Hi Ismael,



Thanks for the quick reply.



Your help is getting me closer. I'm using Survey123 on the web BTW, not Connect.



The template manager validated the syntax. However, when I clicked on "preview sample report", I get this error in a big orange pop up window:


An error occurred when querying data from the feature layer. 400: Cannot perform query. Invalid query parameters. Render expression is: ${# survey | where: "watch_report_item = 'Significant_Case' " | orderByFields:"case_ DESC"}


I'm sure that we're getting closer. I just don't know how close.



I'm not sure what you meant by "without the reference help for your survey".



Thanks for offering input.




0 Kudos
LanceEber
New Contributor II

That screen shot is exactly what I'm trying to accomplish.  Ugh.  Just need to get it to work.

 

0 Kudos
LanceEber
New Contributor II

Here's the report looks like so far. Oh so close to what I need.

IsmaelChivite
Esri Notable Contributor

Hi. By the online reference I meant that cheat sheet page that appears in the Survey123 website where you can see the name of the different questions in your form. Like shown below. This page is important as it helps you get the right field names and values for your queries.

In any event, start with just on table and when you get the syntax right you can add the second. For example, drop Patrol Checks for now and lets focus on Significant Cases.

Attaching v15, although I am going a bit blind without the reference.

 

IsmaelChivite_0-1611862724484.png

 

LanceEber
New Contributor II

Gotcha, so this section?  All of my syntax looks right to me.

watch.JPG

0 Kudos
IsmaelChivite
Esri Notable Contributor

Awesome!  The PDF is looking good! The syntax can be tricky sometimes, but once you get the gist of it you can do pretty nice things with it. I am not sure if you need it, but you can add headers and also break down the case, description and other case info into separate columns within your Word table.  Happy you got this going!

LanceEber
New Contributor II

The goal of the PDF is to eliminate column 1 of each table.  If I can just get the SIGNIFICANT CASE section to just show the "significant cases" and the same for the PATROL CHECK section, I'm golden!!!  Everything looks right. I just don't know what I'm missing.  Thanks for your time.

0 Kudos
LanceEber
New Contributor II

BTW, what kind of "code" or "syntax" is this? MS Word specific?  Interested in finding sources for learning more about it.  Thanks.

0 Kudos