<?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 arcade code problem: varying years in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/arcade-code-problem-varying-years/m-p/1266025#M13262</link>
    <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;I try to create a code with arcade, allowing to create a dat value according to several conditions.&lt;/P&gt;&lt;P&gt;I have a tree data that contains fields not_diag, periodicity, date_diag and maj_previsionnel which is the field where the value should appear.&lt;/P&gt;&lt;P&gt;if the not_diag field is not empty and the periodicity includes 1 then maj_previsionnel=date_diag +1 year&lt;/P&gt;&lt;P&gt;So make this condition on the four periodicity values.&lt;BR /&gt;I wrote the code this way below. The problem is that it doesn’t display anything, so I don’t know if it works or not.&lt;BR /&gt;HELP &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If($feature["note_diag"]!="" &amp;amp;&amp;amp; $feature.periodicite=="1") {&lt;BR /&gt;return ($feature["maj_previsionnelle"])= Dateadd($feature["date_diag"],1,'years');&lt;BR /&gt;}&lt;BR /&gt;else{&lt;BR /&gt;If($feature["note_diag"]!="" &amp;amp;&amp;amp; $feature.periodicite=="2") {&lt;BR /&gt;return (maj_previsionnelle)= Dateadd($feature["date_diag"],2,'years');&lt;BR /&gt;}&lt;BR /&gt;else{&lt;BR /&gt;If($feature["note_diag"]!="" &amp;amp;&amp;amp; $feature.periodicite=="3") {&lt;BR /&gt;return ($feature["maj_previsionnelle"])= Dateadd($feature["date_diag"],3,'years');&lt;BR /&gt;}&lt;BR /&gt;else{&lt;BR /&gt;If($feature["note_diag"]!="" &amp;amp;&amp;amp; $feature.periodicite=="4") {&lt;BR /&gt;return ($feature["maj_previsionnelle"])&lt;BR /&gt;= Dateadd($feature["date_diag"],4,'years');&lt;BR /&gt;}&lt;BR /&gt;}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Mar 2023 16:05:21 GMT</pubDate>
    <dc:creator>SoleneMas</dc:creator>
    <dc:date>2023-03-09T16:05:21Z</dc:date>
    <item>
      <title>arcade code problem: varying years</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/arcade-code-problem-varying-years/m-p/1266025#M13262</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;I try to create a code with arcade, allowing to create a dat value according to several conditions.&lt;/P&gt;&lt;P&gt;I have a tree data that contains fields not_diag, periodicity, date_diag and maj_previsionnel which is the field where the value should appear.&lt;/P&gt;&lt;P&gt;if the not_diag field is not empty and the periodicity includes 1 then maj_previsionnel=date_diag +1 year&lt;/P&gt;&lt;P&gt;So make this condition on the four periodicity values.&lt;BR /&gt;I wrote the code this way below. The problem is that it doesn’t display anything, so I don’t know if it works or not.&lt;BR /&gt;HELP &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If($feature["note_diag"]!="" &amp;amp;&amp;amp; $feature.periodicite=="1") {&lt;BR /&gt;return ($feature["maj_previsionnelle"])= Dateadd($feature["date_diag"],1,'years');&lt;BR /&gt;}&lt;BR /&gt;else{&lt;BR /&gt;If($feature["note_diag"]!="" &amp;amp;&amp;amp; $feature.periodicite=="2") {&lt;BR /&gt;return (maj_previsionnelle)= Dateadd($feature["date_diag"],2,'years');&lt;BR /&gt;}&lt;BR /&gt;else{&lt;BR /&gt;If($feature["note_diag"]!="" &amp;amp;&amp;amp; $feature.periodicite=="3") {&lt;BR /&gt;return ($feature["maj_previsionnelle"])= Dateadd($feature["date_diag"],3,'years');&lt;BR /&gt;}&lt;BR /&gt;else{&lt;BR /&gt;If($feature["note_diag"]!="" &amp;amp;&amp;amp; $feature.periodicite=="4") {&lt;BR /&gt;return ($feature["maj_previsionnelle"])&lt;BR /&gt;= Dateadd($feature["date_diag"],4,'years');&lt;BR /&gt;}&lt;BR /&gt;}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 16:05:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/arcade-code-problem-varying-years/m-p/1266025#M13262</guid>
      <dc:creator>SoleneMas</dc:creator>
      <dc:date>2023-03-09T16:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: arcade code problem: varying years</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/arcade-code-problem-varying-years/m-p/1266103#M13263</link>
      <description>&lt;LI-CODE lang="javascript"&gt;if ($feature["note_diag"] != "" &amp;amp;&amp;amp; $feature.periodicite == "1") {
return Dateadd($feature["date_diag"],1,'years')
}

else if($feature["note_diag"] != "" &amp;amp;&amp;amp; $feature.periodicite == "2") {
return Dateadd($feature["date_diag"],2,'years')
}

else if($feature["note_diag"] != "" &amp;amp;&amp;amp; $feature.periodicite == "3") {
return Dateadd($feature["date_diag"],3,'years')
}

else if($feature["note_diag"] != "" &amp;amp;&amp;amp; $feature.periodicite == "4") {
return Dateadd($feature["date_diag"],4,'years')
}

//else {return something}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 09 Mar 2023 17:51:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/arcade-code-problem-varying-years/m-p/1266103#M13263</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2023-03-09T17:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: arcade code problem: varying years</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/arcade-code-problem-varying-years/m-p/1267005#M13273</link>
      <description>&lt;P&gt;Thank you for your offer.&lt;BR /&gt;However, no value appears either.&lt;BR /&gt;I eassaie to make it appear in the popup is the value is empty knowing that the fields are filled.&lt;/P&gt;&lt;P&gt;Also I wanted to use this technique for collector because we don’t have fieldmap yet, I have a big doubt that this is the right way to automatically propose a value in maj_previsional.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 11:07:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/arcade-code-problem-varying-years/m-p/1267005#M13273</guid>
      <dc:creator>SoleneMas</dc:creator>
      <dc:date>2023-03-13T11:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: arcade code problem: varying years</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/arcade-code-problem-varying-years/m-p/1267030#M13274</link>
      <description>&lt;P&gt;What happens if you set this as the else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;else {return $feature["date_diag"]}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what are you data types for periodicite? string or numbers?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 12:43:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/arcade-code-problem-varying-years/m-p/1267030#M13274</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2023-03-13T12:43:03Z</dc:date>
    </item>
  </channel>
</rss>

