<?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: Using Arcade to calculate and color by time and date in a Dashboard in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1384411#M9091</link>
    <description>&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Do you mean the color is not changing as time progresses? You will need to set a refresh interval if the dashboard is left open and is not being refreshed.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JenniferAcunto_1-1708445835413.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95241i6B50194962695748/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JenniferAcunto_1-1708445835413.png" alt="JenniferAcunto_1-1708445835413.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Feb 2024 16:17:30 GMT</pubDate>
    <dc:creator>JenniferAcunto</dc:creator>
    <dc:date>2024-02-20T16:17:30Z</dc:date>
    <item>
      <title>Using Arcade to calculate and color by time and date in a Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1383410#M9075</link>
      <description>&lt;P&gt;I was asked by my office to create a scheduler app to track meetings.&amp;nbsp; My thoughts were to create a simple Survey123 Connect form that has Meeting Name along with the time and date of said meeting and have that displayed on a Dashboard for people to call up and view.&lt;BR /&gt;&lt;BR /&gt;What was then asked of me was to somehow have a visual cue as the meetings were coming up, in progress, or finished.&amp;nbsp; &amp;nbsp;I started with what I assumed would be a simple red-yellow-green color scale on some test data just to see if it would work.&amp;nbsp; However, I have either come to a point where I am asking the software do something that Esri never expected, I have hit a wall with my Arcade expression ability, or quite possibly a little of both.&amp;nbsp; I think I'm getting hung up in the whole date / time issues but not sure how to fix the problem.&lt;BR /&gt;&lt;BR /&gt;Can anyone give me some advice on what I can do to make this proof of concept work?&amp;nbsp; I've attached a screen grab of my test data in my Dashboard, the attribute table, and my attempt at the Arcade script.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 15:30:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1383410#M9075</guid>
      <dc:creator>Charlie_Kaufman</dc:creator>
      <dc:date>2024-02-16T15:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to calculate and color by time and date in a Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1383607#M9082</link>
      <description>&lt;P&gt;You are on the right track, there are just a couple things to adjust.&lt;/P&gt;&lt;P&gt;You will want to swap the position of your Now and your meeting start date.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;DateDiff(meeting1_time, timenow, 'hours')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your meeting variables where you are returning the color, your else return is 'N/A'. That is not a color, so you need to either supply a default color to return or just use '', to not specify a color at all.&lt;/P&gt;&lt;P&gt;Next, let's look at your time buckets. Your When statement will run in the order you specified, as soon as it hits a true statement it will stop. The first statement it hits is if hours is less than 1. Because 0 is less than 1, your 0 statement will never fire. Additionally, there is a hole in your time buckets at exactly 1. 1 is not less than 1 and it's not greater than 1, so at exactly 1 hour (and only at 1 hour) you will get the default color (which currently is 'N/A'). To get around this you need to create explicit time chunks:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;When(due1 &amp;lt;= 0, '#ffff00', due1 &amp;gt; 0 &amp;amp;&amp;amp; due1 &amp;lt; 1, '#ff0000', '#4c3600')&lt;/LI-CODE&gt;&lt;P&gt;Here we are providing a color at 0 and below, another color for anything between 0 and 1, and since everything else will be 1 or higher, we don't need to spell that out and can use the else value to capture everything else.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you are returning those colors as an attribute, you then have to add them into the HTML of your list to see any of the colors returned.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some blogs that might be useful:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-dashboards-blog/dashboards-that-pop-dynamic-date-alerts/ba-p/1376604" target="_self"&gt;Dashboards That Pop: Dynamic Date Alerts&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-dashboards-blog/dashboards-that-pop-arcade/ba-p/1241244" target="_self"&gt;Dashboards That Pop: Arcade&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-dashboards-blog/dashboards-that-pop-html/ba-p/1237026" target="_self"&gt;Dashboards That Pop: HTML&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 16 Feb 2024 20:03:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1383607#M9082</guid>
      <dc:creator>JenniferAcunto</dc:creator>
      <dc:date>2024-02-16T20:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to calculate and color by time and date in a Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1384360#M9088</link>
      <description>&lt;P&gt;Jen&lt;/P&gt;&lt;P&gt;Thanks for the help.&amp;nbsp; I was able to update my DateDiff calculation and patched the hole in my time bucket as you suggested.&amp;nbsp; &amp;nbsp;I am still having trouble with the colors working.&amp;nbsp; &amp;nbsp;If I set the text color for example my meeting1 variable, it just returns the first color choice and does not honor the colors chosen for any time passing.&lt;BR /&gt;&lt;BR /&gt;Any additional advice?&lt;BR /&gt;&lt;BR /&gt;Charlie&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 15:01:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1384360#M9088</guid>
      <dc:creator>Charlie_Kaufman</dc:creator>
      <dc:date>2024-02-20T15:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to calculate and color by time and date in a Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1384411#M9091</link>
      <description>&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Do you mean the color is not changing as time progresses? You will need to set a refresh interval if the dashboard is left open and is not being refreshed.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JenniferAcunto_1-1708445835413.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95241i6B50194962695748/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JenniferAcunto_1-1708445835413.png" alt="JenniferAcunto_1-1708445835413.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 16:17:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1384411#M9091</guid>
      <dc:creator>JenniferAcunto</dc:creator>
      <dc:date>2024-02-20T16:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to calculate and color by time and date in a Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1389046#M9175</link>
      <description>&lt;P&gt;Thanks for the help with this.&amp;nbsp; I was able to update my draft and I have been able to get my colors to update as the time changes.&lt;BR /&gt;&lt;BR /&gt;So new issue, is that my boss would like to see some of the meetings to have a preset time each day.&amp;nbsp; &amp;nbsp;Meeting 1 - would be at 7am every day.&amp;nbsp; Is there a way to use the now() feature or something like it but keep a default time in place?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 19:28:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1389046#M9175</guid>
      <dc:creator>Charlie_Kaufman</dc:creator>
      <dc:date>2024-02-29T19:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to calculate and color by time and date in a Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1389399#M9179</link>
      <description>&lt;P&gt;I assume you are doing this calculation in your survey. I would not use now(), instead use today(). Today() sets the time to noon, so now that you have a set starting time everytime, you can add a calculation to it to move the time accordingly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your example, 7am is 5 hours behind noon, so the calculation will be:&amp;nbsp;date-time(decimal-date-time(today()) - 0.2083333333333333)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;5 hours&amp;nbsp; = 1 (day) / 24 (hours)&amp;nbsp;* 5 (hours) = 0.2083333333333333&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You might want to check out &lt;A href="https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528" target="_self"&gt;Dates and Times in Survey123&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 13:28:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1389399#M9179</guid>
      <dc:creator>JenniferAcunto</dc:creator>
      <dc:date>2024-03-01T13:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to calculate and color by time and date in a Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1389498#M9182</link>
      <description>&lt;P&gt;Jen.&lt;BR /&gt;&lt;BR /&gt;Thanks for that, the calculations are doing exactly now what I was hoping to see.&amp;nbsp; Now however, they are not following through to the Survey123 form.&amp;nbsp; &amp;nbsp;Any thoughts on this?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="survey2.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/96474i5634CED5E252408A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="survey2.png" alt="survey2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="survey1.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/96475i982FBB2B015806F4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="survey1.png" alt="survey1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 15:44:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1389498#M9182</guid>
      <dc:creator>Charlie_Kaufman</dc:creator>
      <dc:date>2024-03-01T15:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to calculate and color by time and date in a Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1389683#M9186</link>
      <description>&lt;P&gt;Remove the today() from the default field. I'm also noticing that today() is using midnight in the browser instead of noon, so if this is going to be a browser based survey, you will want to adjust your calculations accordingly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 20:16:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/using-arcade-to-calculate-and-color-by-time-and/m-p/1389683#M9186</guid>
      <dc:creator>JenniferAcunto</dc:creator>
      <dc:date>2024-03-01T20:16:34Z</dc:date>
    </item>
  </channel>
</rss>

