<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: If statements with concatenations in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192459#M43748</link>
    <description>&lt;P&gt;At a quick glance, I noticed in your expression that you're missing a parentheses here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Katherine_Clark_0-1657891288773.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/45928i834FC05EDD10ED57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Katherine_Clark_0-1657891288773.png" alt="Katherine_Clark_0-1657891288773.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does adding that fix the statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jul 2022 13:22:06 GMT</pubDate>
    <dc:creator>Katie_Clark</dc:creator>
    <dc:date>2022-07-15T13:22:06Z</dc:date>
    <item>
      <title>If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192390#M43742</link>
      <description>&lt;P&gt;I've read many posts on here but am still having a tough time getting this statement working. Any help is GREATLY APPRECIATED! I broke it down to make it a little easier to read.&lt;BR /&gt;&lt;BR /&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if(selected(${WB}, 'RV'), concat(${RV_ST_LP},${FD_RV},${FD_ST},${RV_ST_WF},${RV_ST_Nat_Mod},${RV_ST_Hum_Mod}),

if(selected${WB}, 'ST'), concat(${RV_ST_LP},${FD_RV},${FD_ST},${RV_ST_WF},${RV_ST_Nat_Mod},${RV_ST_Hum_Mod}),

if(selected(${WB}, 'LK'), concat(${LK_PD_LP},${WB},${LK_PD_WF}),

if(selected(${WB},'PD') and ${LK_PD_LP} != 'TE', concat(${LK_PD_LP},${WB},${LK_PD_WF}),

if(selected(${WB}, 'PD') and ${LK_PD_LP} = 'TE', concat(${LK_PD_TE},${WB},${LK_PD_WF}, 'NULL')))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 00:59:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192390#M43742</guid>
      <dc:creator>EMMA_UM</dc:creator>
      <dc:date>2022-07-15T00:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192459#M43748</link>
      <description>&lt;P&gt;At a quick glance, I noticed in your expression that you're missing a parentheses here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Katherine_Clark_0-1657891288773.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/45928i834FC05EDD10ED57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Katherine_Clark_0-1657891288773.png" alt="Katherine_Clark_0-1657891288773.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does adding that fix the statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 13:22:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192459#M43748</guid>
      <dc:creator>Katie_Clark</dc:creator>
      <dc:date>2022-07-15T13:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192545#M43749</link>
      <description>&lt;P&gt;Good catch! Unfortunately, that did not solve the issue.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 17:49:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192545#M43749</guid>
      <dc:creator>EMMA_UM</dc:creator>
      <dc:date>2022-07-15T17:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192552#M43750</link>
      <description>&lt;P&gt;Sorry, I didn't notice this the first time....I think you need a parentheses here too? Because the 'NULL' is the final ELSE statement. (I highly recommend writing these statements in an editor like this with syntax highlighting! It always helps me with the grouping.)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Katherine_Clark_0-1657907563951.png" style="width: 613px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/45944i08E6290770F9CFF9/image-dimensions/613x118?v=v2" width="613" height="118" role="button" title="Katherine_Clark_0-1657907563951.png" alt="Katherine_Clark_0-1657907563951.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If this still doesn't work I'll try to help more, but...let's try to get the simple stuff out of the way first &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 17:54:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192552#M43750</guid>
      <dc:creator>Katie_Clark</dc:creator>
      <dc:date>2022-07-15T17:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192556#M43751</link>
      <description>&lt;P&gt;It's working! Thanks for your help. Do you have a go-to editor to check syntax (outside of this platform)?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 18:03:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192556#M43751</guid>
      <dc:creator>EMMA_UM</dc:creator>
      <dc:date>2022-07-15T18:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192560#M43752</link>
      <description>&lt;P&gt;So glad you got it working! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For writing quick statements like this, I usually use Notepad++. You don't have to save the document as a certain file type for the parentheses highlighting to display (like you can see in the screenshot, where the matching ones appear in red.)&lt;/P&gt;&lt;P&gt;For more involved coding, I've used PyCharm, Atom, or Sublime depending on the language I'm writing in.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 18:08:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192560#M43752</guid>
      <dc:creator>Katie_Clark</dc:creator>
      <dc:date>2022-07-15T18:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192637#M43753</link>
      <description>&lt;P&gt;Hey Katherine,&lt;BR /&gt;&lt;BR /&gt;Thanks for your help earlier. I'm pretty new to more complex if statements. Connect keeps throwing a "There is no survey element with this name" message when I add in the this formula into the calculation column. There is indeed a a question named, "Water_Mod". I originally wrote this line (row 62) using the string-length function but also tested count-selected. No dice. Any thoughts? XLS is attached. TIA!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if((count-selected(${Water_Mod}) != 0 and count-selected(${Landscape_Mod}) = 0), ${Water_Mod}), if((count-selected(${Water_Mod}) = 0 and count-selected(${Landscape_Mod}) != 0), ${Landscape_Mod}), if((${count-selected(${Water_Mod}) != 0 and scount-selected(${Landscape_Mod}) != 0), concat(${Water_Mod}, ',' ,${Landscape_Mod}), ''))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jul 2022 00:25:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192637#M43753</guid>
      <dc:creator>EMMA_UM</dc:creator>
      <dc:date>2022-07-16T00:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192890#M43766</link>
      <description>&lt;P&gt;There are a couple of errors in your calculation that are causing you issues:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;if((&lt;FONT color="#FF0000"&gt;${&lt;/FONT&gt;count-selected(${Water_Mod}) != 0&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Your parenthesis are very unbalanced. I recommend doing what Katherine suggested and building your statements in Notepad ++. I used Notepadd++ to count each parenthesis and you have 13 opening ones, but 16 closing ones.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2022-07-18_7-19-46.png" style="width: 355px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/46040iE6AC402AB6611E59/image-dimensions/355x450?v=v2" width="355" height="450" role="button" title="2022-07-18_7-19-46.png" alt="2022-07-18_7-19-46.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3. Your calculation is a list of values to display if any of your expressions are true, but if statements require a default value to provide when your expressions are false. You do not need the last if statement at all, as that is your default false value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;if(count-selected(${Water_Mod}) !=0 and count-selected(${Landscape_Mod}) =0, ${Water_Mod},&lt;BR /&gt;if(count-selected(${Water_Mod}) =0 and count-selected(${Landscape_Mod}) !=0, ${Landscape_Mod}, concat(${Water_Mod},', ', ${Landscape_Mod})))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some general tips to writing and troubleshooting long calculations:&lt;/P&gt;&lt;P&gt;Write it out elsewhere and break it up so it's easier to read. Use the count feature to ensure your brackets and parentheses are balanced. If you keep getting an error and can't figure out what it is, add your calculation line by line and save each time to narrow down which section of your calculation is having issues. For example, I would first add.&amp;nbsp;&lt;/P&gt;&lt;P&gt;if(count-selected(${Water_Mod}) !=0 and count-selected(${Landscape_Mod}) =0, ${Water_Mod}, '')&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that saved without any errors I would then add in the second piece.&lt;/P&gt;&lt;P&gt;if(count-selected(${Water_Mod}) !=0 and count-selected(${Landscape_Mod}) =0, ${Water_Mod},&lt;BR /&gt;if(count-selected(${Water_Mod}) =0 and count-selected(${Landscape_Mod}) !=0, ${Landscape_Mod}, ''))&lt;/P&gt;&lt;P&gt;If that saved without any errors, then I know the issues is probably with the final section and would do a deep dive into it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 13:38:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1192890#M43766</guid>
      <dc:creator>JenniferAcunto</dc:creator>
      <dc:date>2022-07-18T13:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1193161#M43770</link>
      <description>&lt;P&gt;Thanks for the advice Jennifer! As you can tell, I'm a bit green on this topic. I was able to get the expression working!&lt;BR /&gt;&lt;BR /&gt;Using " '' " will leave the field NULL, correct? The idea is to leave it NULL if no selections are made in Water_Mod or Landscape_Mod fields.&lt;BR /&gt;&lt;BR /&gt;if(count-selected(${Water_Mod}) !=0 and count-selected(${Landscape_Mod}) =0, ${Water_Mod}, if(count-selected(${Water_Mod}) =0 and count-selected(${Landscape_Mod}) !=0, ${Landscape_Mod},&lt;BR /&gt;if(count-selected(${Water_Mod}) !=0 and count-selected(${Landscape_Mod}) !=0, concat(${Water_Mod},', ', ${Landscape_Mod}), if(count-selected(${Water_Mod}) =0 and count-selected(${Landscape_Mod}) =0, '', ''))))&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 20:26:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1193161#M43770</guid>
      <dc:creator>EMMA_UM</dc:creator>
      <dc:date>2022-07-18T20:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: If statements with concatenations</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1193173#M43771</link>
      <description>&lt;P&gt;Yep. A pair of empty quotes will leave the field null.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 20:44:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/if-statements-with-concatenations/m-p/1193173#M43771</guid>
      <dc:creator>JenniferAcunto</dc:creator>
      <dc:date>2022-07-18T20:44:08Z</dc:date>
    </item>
  </channel>
</rss>

