<?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 How to add multiple If/else statements in arcade? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-add-multiple-if-else-statements-in-arcade/m-p/510062#M22454</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to write a script with multiple If/else statements because I am needing to calculate a field with multiple fields, but some of these fields have null values. The script I have is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$feature.AddressNumber + $feature.AddNum_Suf + " " + $feature.StreetNamePreDirectional + " " + $feature.StreetNamePreType + " " + $feature.StreetName + " " + $feature.StreetNamePostType + "," + " " + $feature.PostalCommunityName + " " + $feature.PostalCode&lt;/P&gt;&lt;P&gt;if (IsEmpty($feature.AddressNumber)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.AddressNumber&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.AddNum_Suf)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.AddNum_Suf&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.StreetNamePreDirectional)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.StreetNamePreDirectional&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.StreetNamePreType)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.StreetNamePreType&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.StreetName)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.StreetName&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.StreetNamePostType)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.StreetNamePostType&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I am having is that the script is only returning the "&lt;SPAN&gt;$feature.AddressNumber". I am very novice with scripts but am stuck with what to do on this one. Any help is appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Oct 2019 13:09:22 GMT</pubDate>
    <dc:creator>BlakeLiss</dc:creator>
    <dc:date>2019-10-10T13:09:22Z</dc:date>
    <item>
      <title>How to add multiple If/else statements in arcade?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-add-multiple-if-else-statements-in-arcade/m-p/510062#M22454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to write a script with multiple If/else statements because I am needing to calculate a field with multiple fields, but some of these fields have null values. The script I have is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$feature.AddressNumber + $feature.AddNum_Suf + " " + $feature.StreetNamePreDirectional + " " + $feature.StreetNamePreType + " " + $feature.StreetName + " " + $feature.StreetNamePostType + "," + " " + $feature.PostalCommunityName + " " + $feature.PostalCode&lt;/P&gt;&lt;P&gt;if (IsEmpty($feature.AddressNumber)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.AddressNumber&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.AddNum_Suf)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.AddNum_Suf&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.StreetNamePreDirectional)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.StreetNamePreDirectional&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.StreetNamePreType)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.StreetNamePreType&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.StreetName)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.StreetName&lt;BR /&gt;}&lt;BR /&gt;if (IsEmpty($feature.StreetNamePostType)){&lt;BR /&gt;return ""&lt;BR /&gt;} else {&lt;BR /&gt;return $feature.StreetNamePostType&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I am having is that the script is only returning the "&lt;SPAN&gt;$feature.AddressNumber". I am very novice with scripts but am stuck with what to do on this one. Any help is appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:09:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-add-multiple-if-else-statements-in-arcade/m-p/510062#M22454</guid>
      <dc:creator>BlakeLiss</dc:creator>
      <dc:date>2019-10-10T13:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple If/else statements in arcade?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-add-multiple-if-else-statements-in-arcade/m-p/510063#M22455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/354795" target="_blank"&gt;Blake Liss&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume you want to construct an address line&amp;nbsp;from multiple fields. When&amp;nbsp;the code hits a line with "return" it will stop there. You will have to use variables to store the corrected field data and concatenate those at the end of the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you will have to do something like this for each field:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; AddressNumber &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;!&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;IsEmpty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddressNumber&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    AddressNumber &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddressNumber&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and at the end concatenate the variable AddressNumber with the other variable and return that result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:20:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-add-multiple-if-else-statements-in-arcade/m-p/510063#M22455</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T22:20:20Z</dc:date>
    </item>
  </channel>
</rss>

