<?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: Trying to add an alert based on two parameters in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/trying-to-add-an-alert-based-on-two-parameters/m-p/1371879#M8959</link>
    <description>&lt;P&gt;That's a good reference to keep in my pocket. Thank you I appreciate it!&lt;/P&gt;&lt;P&gt;It doesn't do exactly what I am trying to do. I worked on it to get it to work but had to take a different approach. I want to still clean up my code and when I'm playing around Ill try some of these ideas and see where they go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2024 20:03:01 GMT</pubDate>
    <dc:creator>APBlough</dc:creator>
    <dc:date>2024-01-18T20:03:01Z</dc:date>
    <item>
      <title>Trying to add an alert based on two parameters</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/trying-to-add-an-alert-based-on-two-parameters/m-p/1371763#M8956</link>
      <description>&lt;P&gt;I am struggling to get the result I want. Want to set an alert text (in this case 'ALERT' if two criteria are met. It has to be over 10 days old and another attribute cannot be "Mapped in GIS"&lt;/P&gt;&lt;P&gt;I think I got into the weeds and have a mess. I know the str=Find line is not working. I am trying to just find things that contained "mapped" but this line looks to be returning everything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var y = NOW();&lt;BR /&gt;var z = date($datapoint.DateTieIn);&lt;BR /&gt;var w = DateDiff(y,z,'days')&lt;BR /&gt;var str=Find("Mapped",Upper($datapoint.GISStatus))&lt;BR /&gt;var b = IIf((str&amp;gt;(-1)),5,0)&lt;BR /&gt;var c = iif(w&amp;gt;'10',1,0)&lt;BR /&gt;var e = Sum(b,c);&lt;BR /&gt;var a = iif(e==0,'',&lt;BR /&gt;iif(e==1,'ALERT',&lt;BR /&gt;iif(e==5,'',&lt;BR /&gt;IIF(e==6,'',"ERROR"))))&lt;/P&gt;&lt;P&gt;return {&lt;BR /&gt;textColor: '',&lt;BR /&gt;backgroundColor: '',&lt;BR /&gt;separatorColor:'',&lt;BR /&gt;selectionColor: '',&lt;BR /&gt;selectionTextColor: '',&lt;BR /&gt;attributes: {&lt;BR /&gt;a:a,&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are my variables;&amp;nbsp;&lt;/P&gt;&lt;P&gt;y= Todays Date&lt;/P&gt;&lt;P&gt;z= Date Tied In&lt;/P&gt;&lt;P&gt;w= Days elapsed since Tie In&lt;/P&gt;&lt;P&gt;str= find only those containing 'Mapped' text&amp;nbsp;&lt;/P&gt;&lt;P&gt;b=Result of str&lt;/P&gt;&lt;P&gt;c=if over 10 days since tie in give a value&amp;nbsp;&lt;/P&gt;&lt;P&gt;e= Adding results of the "Mapped" search with Days old value&amp;nbsp;&lt;/P&gt;&lt;P&gt;a=Based on the sum in e there were 4 possible combinations I only want an alert for 1 which is (0 (not mapped) + 1 (over 10 days old)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 17:28:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/trying-to-add-an-alert-based-on-two-parameters/m-p/1371763#M8956</guid>
      <dc:creator>APBlough</dc:creator>
      <dc:date>2024-01-18T17:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to add an alert based on two parameters</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/trying-to-add-an-alert-based-on-two-parameters/m-p/1371858#M8957</link>
      <description>&lt;P&gt;Hi Adam,&lt;/P&gt;&lt;P&gt;It's not clear to me what element type you're working with, but perhaps this will put you on the right track. I wrote an expression that checks your two conditions, then changes the background color of a list item if both conditions are met, and also adds the text ALERT to the item.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var DateTieIn = $datapoint.DateTieIn;
var GISStatus = $datapoint.GISStatus;

var moreThanTenDays;
var alert;
var alertText;

IIf(DateDiff(NOW(), DateTieIn, "days") &amp;gt; 10,
    moreThanTenDays = true,
    moreThanTenDays = false
);

IIf(moreThanTenDays == true &amp;amp;&amp;amp; GISStatus != "Mapped in GIS",
    alert = true,
    alert = false
);

IIf(alert, alertText = 'ALERT', alertText = null);

return {
  textColor: '',
  backgroundColor: IIf(alert, 'red', 'white'),
  separatorColor:'',
  selectionColor: '',
  selectionTextColor: '',
  attributes: {alertText:alertText}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JosephRhodes2_2-1705606798335.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92052i47E2956B25453319/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JosephRhodes2_2-1705606798335.png" alt="JosephRhodes2_2-1705606798335.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here's how the Line item template is configured:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JosephRhodes2_3-1705606895475.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92053iB9D1AE95DBDF2BF8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JosephRhodes2_3-1705606895475.png" alt="JosephRhodes2_3-1705606895475.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 19:52:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/trying-to-add-an-alert-based-on-two-parameters/m-p/1371858#M8957</guid>
      <dc:creator>JRhodes</dc:creator>
      <dc:date>2024-01-18T19:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to add an alert based on two parameters</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/trying-to-add-an-alert-based-on-two-parameters/m-p/1371879#M8959</link>
      <description>&lt;P&gt;That's a good reference to keep in my pocket. Thank you I appreciate it!&lt;/P&gt;&lt;P&gt;It doesn't do exactly what I am trying to do. I worked on it to get it to work but had to take a different approach. I want to still clean up my code and when I'm playing around Ill try some of these ideas and see where they go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 20:03:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/trying-to-add-an-alert-based-on-two-parameters/m-p/1371879#M8959</guid>
      <dc:creator>APBlough</dc:creator>
      <dc:date>2024-01-18T20:03:01Z</dc:date>
    </item>
  </channel>
</rss>

