<?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 to change text color based on date in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634529#M59260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Jun 2020 19:29:04 GMT</pubDate>
    <dc:creator>AndrewSD</dc:creator>
    <dc:date>2020-06-24T19:29:04Z</dc:date>
    <item>
      <title>Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634525#M59256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need an arcade expression that changes the text color based on age. So if if the age is 5 days or less its green text, between 6-10 days its yellow and 11-15 days is red. I am not that experienced with arcade and I tried to find examples of what I wanted and I tired to make it but could not get it to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var val = $datapoint.Age;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var textColor ="green";&lt;BR /&gt;if (val &amp;lt;= 5);&lt;BR /&gt;result='green'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var textColor ="yellow";&lt;BR /&gt;if (val &amp;lt;= 10);&lt;BR /&gt;results='yellow'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var textColor ="red";&lt;BR /&gt;if (val &amp;gt;= 13);&lt;BR /&gt;results='red'&lt;/P&gt;&lt;P&gt;return results;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure how to made the range value of between 6-10 days.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for any help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 14:18:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634525#M59256</guid>
      <dc:creator>AndrewSD</dc:creator>
      <dc:date>2020-06-24T14:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634526#M59257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want to use if...else to test val for various values:&lt;/P&gt;&lt;P&gt;&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; val &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; $datapoint&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Age&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;val &lt;SPAN class="operator token"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  results&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'green'&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;val &lt;SPAN class="operator token"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  results&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'yellow'&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;val &lt;SPAN class="operator token"&gt;&amp;gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;13&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  results&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'red'&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//what happens for values between 10 and 13?&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; results&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;/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;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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:59:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634526#M59257</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-12T02:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634527#M59258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!! I was trying to make it a range so less than 5 days is green, between 6-10 days is yellow and and that 13 should have been an 11 so anything older than 11 is red. I just don't know how to show the range &lt;EM&gt;&lt;STRONG&gt;greater than 6 and less than 10.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 15:10:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634527#M59258</guid>
      <dc:creator>AndrewSD</dc:creator>
      <dc:date>2020-06-24T15:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634528#M59259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's what you need for your revised values:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;var val = $datapoint.Age;

if (val &amp;lt;= 5) {
  results='green'
} else if (val &amp;lt;= 10) {
  results='yellow'
} else {
  results='red'
}
return results;‍‍‍‍‍‍‍‍‍‍&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;/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;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This if..else statement evaluates val and set the results variable for the first time the condition is true. So for a value of 6, the first if statement (val &amp;lt;= 5) isn't true, so it then tests it for the next condition (val &amp;lt;= 10). It meets that condition, so results is set to "yellow".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:59:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634528#M59259</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-12T02:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634529#M59260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 19:29:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634529#M59260</guid>
      <dc:creator>AndrewSD</dc:creator>
      <dc:date>2020-06-24T19:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634530#M59261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If this has answered your question, please click the "Mark Correct" button&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 19:34:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634530#M59261</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2020-06-24T19:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634531#M59262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to take advantage of Arcade in Dashboard Beta and one thing I wanted to do was get the date difference between creation date and now. I used the DateDiff(now, feature.date, 'day') but it doesn't apply this to the Age field and show up on my list. Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 19:37:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634531#M59262</guid>
      <dc:creator>AndrewSD</dc:creator>
      <dc:date>2020-06-24T19:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634532#M59263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Isn't the age field just a number and not a date?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 19:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634532#M59263</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2020-06-24T19:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634533#M59264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a field called age in my feature layer on a webmap and calculated that by using the datediff function but it is static. I was hoping that in the Dashboard setting I could create a arcade expression that would update my list widget (based on the feature layer) to reflect how old a request was.&amp;nbsp; So from day to day it would say its 1 day old, 2 day old, etc. and then once passed 5 day would turn yellow to mark urgency to take care of that request.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 20:06:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634533#M59264</guid>
      <dc:creator>AndrewSD</dc:creator>
      <dc:date>2020-06-24T20:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634534#M59265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a look at this blog post:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/community/commercial/blog/2020/03/10/arcade-calculating-relative-time-for-popups-and-symbology"&gt;https://community.esri.com/community/commercial/blog/2020/03/10/arcade-calculating-relative-time-for-popups-and-symbology&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 20:15:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634534#M59265</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2020-06-24T20:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to change text color based on date</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634535#M59266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is exactly what I was looking for! Thank you, you are a lifesaver!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 20:19:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcade-expression-to-change-text-color-based-on/m-p/634535#M59266</guid>
      <dc:creator>AndrewSD</dc:creator>
      <dc:date>2020-06-24T20:19:01Z</dc:date>
    </item>
  </channel>
</rss>

