<?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: Arcade expression with multiple variables in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1074180#M40996</link>
    <description>&lt;P&gt;You are my hero&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;It works! Only thing is, that I cant apply any symbology yet since there are no inspetions done yet. But that will be fixed over time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I am learning from this again to build these kind of expressions. Thank you very much.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":flexed_biceps:"&gt;💪&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jun 2021 14:40:11 GMT</pubDate>
    <dc:creator>Sietse_de_Haan</dc:creator>
    <dc:date>2021-06-30T14:40:11Z</dc:date>
    <item>
      <title>Arcade expression with multiple variables</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1073596#M40976</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I am creating a map to perform inspections on several locations. These locations have different quality to be maintained at, "onderhoudskwaliteit". During the inspection, the quality will be noted in the survey, "kwaliteit_inspectie". There are several answers possible when there is no maintenance needed and vice versa. I have written these answers in the expression so the expression knows what to return. So far so good I believe.&lt;/P&gt;&lt;P&gt;The next step is, to check the inspection date when the expression returns 'Geen onderhoud'. When this is returned, the expression needs to return "Onderhoud in verschiet" after 14 days, and "Onderhoud uitvoeren" after 28 days.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I'm not that good yet at writing expressions I would like some help with this. So far I have written the expression shown below, but this one isn't working yet. Where am I making mistakes, or how would you guys write this expression?&lt;/P&gt;&lt;P&gt;Thank you in advanced!&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;var inspectie = $feature.kwaliteit_inspectie&lt;BR /&gt;var kwaliteit = $feature.onderhoudskwaliteit&lt;BR /&gt;var days = DateDiff(Now(), $feature.CreationDate, "days")&lt;/P&gt;&lt;P&gt;when(&lt;BR /&gt;kwaliteit "B" == "A+", "Geen onderhoud",&lt;BR /&gt;kwaliteit "B" == "A", "Geen onderhoud",&lt;BR /&gt;kwaliteit "B" == "B", "Geen onderhoud",&lt;BR /&gt;kwaliteit "B" == "C", "Onderhoud uitvoeren",&lt;BR /&gt;kwaliteit "B" == "D", "Onderhoud uitvoeren",&lt;BR /&gt;kwaliteit "C" == "A+", "Geen onderhoud",&lt;BR /&gt;kwaliteit "C" == "A", "Geen onderhoud",&lt;BR /&gt;kwaliteit "C" == "B", "Geen onderhoud",&lt;BR /&gt;kwaliteit "C" == "C", "Geen onderhoud",&lt;BR /&gt;kwaliteit "C" == "D", "Onderhoud uitvoeren"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;when(&lt;BR /&gt;"Geen onderhoud"&lt;BR /&gt;if (days &amp;gt; 14) {&lt;BR /&gt;return "Onderhoud in verschiet";&lt;BR /&gt;}&lt;BR /&gt;if (days &amp;gt; 28) {&lt;BR /&gt;return "Onderhoud uitvoeren";&lt;BR /&gt;else {&lt;BR /&gt;return "Geen onderhoud";}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 11:01:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1073596#M40976</guid>
      <dc:creator>Sietse_de_Haan</dc:creator>
      <dc:date>2021-06-29T11:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression with multiple variables</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1073633#M40977</link>
      <description>&lt;LI-CODE lang="javascript"&gt;var inspectie = $feature.kwaliteit_inspectie
var kwaliteit = $feature.onderhoudskwaliteit
var days = DateDiff(Now(), $feature.CreationDate, "days")


//function to assign numeric values to the letters
function textValue(input) {
    if (input == 'D') {
        return 1
    }
    if (input == 'C') {
        return 2
    }
    if (input == 'B') {
        return 3
    }
    if (input == 'A') {
        return 4
    }
    if (input == 'A+') {
        return 5
    }

}

//run the function against quality and inspection
var inspectieNumber = textValue(inspectie)
var kwaliteitNumber = textValue(kwaliteit)

//if inspection &amp;gt;= quality, assign 'Geen 'etc... to qualityResult
var qualityResult = ''
if (inspectieNumber &amp;gt;= kwaliteitNumber) {
    qualityResult = "Geen onderhoud"
}
else {
    qualityResult =  "Onderhoud uitvoeren"
}
 
var finalResult = qualityResult

if (qualityResult == "Geen onderhoud" &amp;amp;&amp;amp; days &amp;gt; 14) {
    finalResult = "Onderhoud in verschiet";
}
if (qualityResult == "Geen onderhoud" &amp;amp;&amp;amp; days &amp;gt; 28) {
    finalResult = "Onderhoud uitvoeren";
}

return finalResult&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Jun 2021 13:05:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1073633#M40977</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-06-29T13:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression with multiple variables</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1073637#M40978</link>
      <description>&lt;P&gt;Great example of a custom function!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 13:09:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1073637#M40978</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-06-29T13:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression with multiple variables</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1073639#M40979</link>
      <description>&lt;P&gt;one forgetting that 'else if' exists! There must also be a less verbose way to assign the numbers to the letters?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 13:11:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1073639#M40979</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-06-29T13:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression with multiple variables</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1074180#M40996</link>
      <description>&lt;P&gt;You are my hero&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;It works! Only thing is, that I cant apply any symbology yet since there are no inspetions done yet. But that will be fixed over time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I am learning from this again to build these kind of expressions. Thank you very much.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":flexed_biceps:"&gt;💪&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 14:40:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-with-multiple-variables/m-p/1074180#M40996</guid>
      <dc:creator>Sietse_de_Haan</dc:creator>
      <dc:date>2021-06-30T14:40:11Z</dc:date>
    </item>
  </channel>
</rss>

