<?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: Attribute expression - adding conditional statement to When statement in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-expression-adding-conditional-statement/m-p/1398955#M80737</link>
    <description>&lt;P&gt;No, you shouldn't need to! You can add the if before the when statement and just enclose it all in the curly bracket:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var status = DomainName($feature, 'CURR_PHASE')
console($feature.CURR_PHASE)
var phrase
if (PROJ_BEGIN != null){
phrase = When (status == 'Construction',"Project began in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and is anticipated to be completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Design', "Project is anticipated to begin in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and expected to be completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Completed', "Project began in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and was completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Closeout', "Project began in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and was completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Study', "No projected start date at this time",
                   "N/A")
}
else {
phrase = ''
}
return phrase;&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 21 Mar 2024 12:36:54 GMT</pubDate>
    <dc:creator>ZachBodenner</dc:creator>
    <dc:date>2024-03-21T12:36:54Z</dc:date>
    <item>
      <title>Attribute expression - adding conditional statement to When statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-expression-adding-conditional-statement/m-p/1398781#M80717</link>
      <description>&lt;P&gt;I have a When statement that works! but now I need to add an IF statement that checks another field before it applies the When statement.&lt;/P&gt;&lt;P&gt;I have tried several attempts but nothing is working. I am wanting to check first to see if my field PROJ_BEGIN = &amp;lt;null&amp;gt; (If null-do not add phrase) else proceed with When cause. Do I need to create an if/else statement for each variable for PROJ_BEGIN?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var status = DomainName($feature, 'CURR_PHASE')
console($feature.CURR_PHASE)
var phrase = When (status == 'Construction',"Project began in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and is anticipated to be completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Design', "Project is anticipated to begin in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and expected to be completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Completed', "Project began in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and was completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Closeout', "Project began in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and was completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Study', "No projected start date at this time",
                   "N/A")
return phrase;&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 20 Mar 2024 23:01:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-expression-adding-conditional-statement/m-p/1398781#M80717</guid>
      <dc:creator>sanderson_OC</dc:creator>
      <dc:date>2024-03-20T23:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute expression - adding conditional statement to When statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-expression-adding-conditional-statement/m-p/1398955#M80737</link>
      <description>&lt;P&gt;No, you shouldn't need to! You can add the if before the when statement and just enclose it all in the curly bracket:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var status = DomainName($feature, 'CURR_PHASE')
console($feature.CURR_PHASE)
var phrase
if (PROJ_BEGIN != null){
phrase = When (status == 'Construction',"Project began in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and is anticipated to be completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Design', "Project is anticipated to begin in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and expected to be completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Completed', "Project began in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and was completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Closeout', "Project began in the " + ($feature.PROJ_BEGIN) + " of "+ ($feature.BEGIN_YEAR) +" and was completed in the "+ ($feature.PROJ_END) + " of " + ($feature.END_YEAR),
                   status == 'Study', "No projected start date at this time",
                   "N/A")
}
else {
phrase = ''
}
return phrase;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 21 Mar 2024 12:36:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-expression-adding-conditional-statement/m-p/1398955#M80737</guid>
      <dc:creator>ZachBodenner</dc:creator>
      <dc:date>2024-03-21T12:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute expression - adding conditional statement to When statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-expression-adding-conditional-statement/m-p/1398968#M80739</link>
      <description>&lt;P&gt;The other way to do that is like this, returning null if the PROG_BEGIN is null. It also uses &lt;A href="https://developers.arcgis.com/arcade/guide/template-literals/" target="_self"&gt;template literals&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var status = DomainName($feature, 'CURR_PHASE')
console($feature.CURR_PHASE)
if ($feature.PROJ_BEGIN == null) return;
var phrase = When (status == 'Construction', `Project began in the ${$feature.PROJ_BEGIN} of ${$feature.BEGIN_YEAR} and is anticipated to be completed in the ${$feature.PROJ_END} of ${$feature.END_YEAR}`,
                   status == 'Design', `Project is anticipated to begin in the ${$feature.PROJ_BEGIN} of ${$feature.BEGIN_YEAR} and expected to be completed in the ${$feature.PROJ_END} of ${$feature.END_YEAR}`,
                   status == 'Completed', `Project began in the ${$feature.PROJ_BEGIN} of ${$feature.BEGIN_YEAR} and was completed in the ${$feature.PROJ_END} of ${$feature.END_YEAR}`,
                   status == 'Closeout', `Project began in the ${$feature.PROJ_BEGIN} of ${$feature.BEGIN_YEAR} and was completed in the "${$feature.PROJ_END} of ${$feature.END_YEAR}`,
                   status == 'Study', "No projected start date at this time",
                   "N/A")
return phrase;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 13:00:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-expression-adding-conditional-statement/m-p/1398968#M80739</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-03-21T13:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute expression - adding conditional statement to When statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-expression-adding-conditional-statement/m-p/1400665#M80925</link>
      <description>&lt;P&gt;Thank you, worked perfectly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 23:30:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-expression-adding-conditional-statement/m-p/1400665#M80925</guid>
      <dc:creator>sanderson_OC</dc:creator>
      <dc:date>2024-03-25T23:30:54Z</dc:date>
    </item>
  </channel>
</rss>

