<?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: Compare multiple features fields to create string | Popup/Arcade in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/compare-multiple-features-fields-to-create-string/m-p/1494671#M59767</link>
    <description>&lt;P&gt;I figured it out, took a bit but for anyone else that needs info here was the final&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// grab the ID of the storm and filter features
var id = $feature.STORM_ID;
var fs = Filter(FeatureSetByName($map, 'Tropical_WOM', ['BEGIN_CLASSIFICATION', 'BEGIN_DATE_TIME', 'END_CLASSIFICATION', 'END_DATE_TIME']), 'STORM_ID = &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/354972"&gt;@ID&lt;/a&gt;');

// Initialize an array to hold unique classifications
var uniqueClassifications = [];

// Function to format the date and time
function formatDateTime(dateTime) {
   return Text(dateTime, 'MMMM DD, YY hh:mma');
}

// Initialize previous classification as empty
var prevClassification = '';

// Loop through the features using a for loop
for (var f in fs) {
   var beginClass = f.BEGIN_CLASSIFICATION;
   var endClass = f.END_CLASSIFICATION;
   var beginTime = formatDateTime(f.BEGIN_DATE_TIME);
   var endTime = formatDateTime(f.END_DATE_TIME);
   // Check if the current classification is different from the previous one
   if (beginClass != prevClassification) {
       // Add the classification and begin time to the array
       Push(uniqueClassifications, (beginClass + ': ' + beginTime));
   }
   // If the end classification is different from the begin classification, add it as well
   if (endClass != beginClass) {
       Push(uniqueClassifications, (endClass + ': ' + endTime));
   }
   // Update the previous classification
   prevClassification = endClass;
}

// Join the classifications with the arrow symbol to create the final string
var finalString = Concatenate(uniqueClassifications,' → ')
// Return the final string
return finalString;&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 18 Jun 2024 21:34:15 GMT</pubDate>
    <dc:creator>SpatialSean</dc:creator>
    <dc:date>2024-06-18T21:34:15Z</dc:date>
    <item>
      <title>Compare multiple features fields to create string | Popup/Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/compare-multiple-features-fields-to-create-string/m-p/1494456#M59759</link>
      <description>&lt;P&gt;I am trying to create a string to provide a reduced look at tropical storm systems.&amp;nbsp; I've gotten close but am struggling with looping and comparing the items since they are in different fields from different features.&amp;nbsp; Since storms change in classification throughout the timeline I want to reduce to only show those changes.&amp;nbsp; This would be my final block of text (or similar):&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Tropical Rainstorm: June 18, 2024 at 11:00 AM → Tropical Storm: June 19, 2024 at 11:00 PM → Tropical Depression: June 20, 2024 at 8:00 AM → Tropical Rainstorm: June 20, 2024 at 8:00 PM&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Storm begins as a tropical rainstorm on the 18th, changes to a tropical storm on the 19th at 11pm, then a tropical depression on the 20th at 8am, and so on.&amp;nbsp; It would be simple to grab Distinct values but I need to compare the Begin and End classifications then add the times.&lt;/P&gt;&lt;P&gt;_DATE_TIME is a date/time field,&amp;nbsp;_LABEL is string&lt;/P&gt;&lt;P&gt;STORM_ID is the unique ID&lt;/P&gt;&lt;TABLE width="1156"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;BEGIN_CLASSIFICATION&lt;/TD&gt;&lt;TD&gt;BEGIN_DATE_TIME&lt;/TD&gt;&lt;TD&gt;BEGIN_DATE_TIME_LABEL&lt;/TD&gt;&lt;TD&gt;END_CLASSIFICATION&lt;/TD&gt;&lt;TD&gt;END_DATE_TIME&lt;/TD&gt;&lt;TD&gt;END_DATE_TIME_LABEL&lt;/TD&gt;&lt;TD&gt;STORM_ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 18, 2024 at 11:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 18 2024 10:00AM CDT&lt;/TD&gt;&lt;TD width="158"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 18, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 18 2024 7:00PM CDT&lt;/TD&gt;&lt;TD width="88"&gt;2,511&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 18, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 18 2024 7:00PM CDT&lt;/TD&gt;&lt;TD width="158"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 8:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 7:00AM CDT&lt;/TD&gt;&lt;TD width="88"&gt;2,511&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 8:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 7:00AM CDT&lt;/TD&gt;&lt;TD width="158"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 7:00PM CDT&lt;/TD&gt;&lt;TD width="88"&gt;2,511&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 7:00PM CDT&lt;/TD&gt;&lt;TD width="158"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 11:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 10:00PM CDT&lt;/TD&gt;&lt;TD width="88"&gt;2,511&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 11:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 10:00PM CDT&lt;/TD&gt;&lt;TD width="158"&gt;Tropical Depression&lt;/TD&gt;&lt;TD width="183"&gt;June 20, 2024 at 8:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 20 2024 7:00AM CDT&lt;/TD&gt;&lt;TD width="88"&gt;2,511&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Depression&lt;/TD&gt;&lt;TD width="183"&gt;June 20, 2024 at 8:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 20 2024 7:00AM CDT&lt;/TD&gt;&lt;TD width="158"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 20, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 20 2024 7:00PM CDT&lt;/TD&gt;&lt;TD width="88"&gt;&lt;P&gt;2,511&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From this I expect needing to create a dictionary and or an array where&amp;nbsp;I combine the Classification fields, Time Fields, and Time Labels&amp;nbsp;where I can then perform a sort on the TIME&lt;/P&gt;&lt;P&gt;I've kept the TIME_LABEL since it is already a string and I wouldn't need to convert TIME later via Text().&lt;/P&gt;&lt;TABLE width="541"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CLASSIFICATION&lt;/TD&gt;&lt;TD&gt;TIME&lt;/TD&gt;&lt;TD&gt;TIME_LABEL&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 18, 2024 at 11:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 18 2024 10:00AM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 18, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 18 2024 7:00PM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 18, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 18 2024 7:00PM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 11:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 10:00PM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 11:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 10:00PM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 8:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 7:00AM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 8:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 7:00AM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 7:00PM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 7:00PM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Depression&lt;/TD&gt;&lt;TD width="183"&gt;June 20, 2024 at 8:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 20 2024 7:00AM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Depression&lt;/TD&gt;&lt;TD width="183"&gt;June 20, 2024 at 8:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 20 2024 7:00AM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 20, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 20 2024 7:00PM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that I would then run a for loop and compare the next value and if they match skip to result in a final as such:&lt;/P&gt;&lt;TABLE width="541"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CLASSIFICATION&lt;/TD&gt;&lt;TD&gt;TIME&lt;/TD&gt;&lt;TD&gt;TIME_LABEL&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 18, 2024 at 11:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 18 2024 10:00AM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Storm&lt;/TD&gt;&lt;TD width="183"&gt;June 19, 2024 at 11:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 19 2024 10:00PM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Depression&lt;/TD&gt;&lt;TD width="183"&gt;June 20, 2024 at 8:00 AM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 20 2024 7:00AM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="172"&gt;Tropical Rainstorm&lt;/TD&gt;&lt;TD width="183"&gt;June 20, 2024 at 8:00 PM&lt;/TD&gt;&lt;TD width="186"&gt;Jun 20 2024 7:00PM CDT&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that returning the items with the proper format of the string from above:&lt;/P&gt;&lt;P&gt;Tropical Rainstorm: June 18, 2024 at 11:00 AM → Tropical Storm: June 19, 2024 at 11:00 PM → Tropical Depression: June 20, 2024 at 8:00 AM → Tropical Rainstorm: June 20, 2024 at 8:00 PM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//grab the ID of the storm
var id = $feature.STORM_ID
//filter for all the features with the same ID
var fs = Filter(FeatureSetByName($map, 'Tropical_WOM',['BEGIN_CLASSIFICATION','BEGIN_DATE_TIME','END_CLASSIFICATION','END_DATE_TIME']), 'STORM_ID = &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/354972"&gt;@ID&lt;/a&gt;')
//count number of features for iterating
var items = Count(fs)
Console(items)
//set a counter to 0 for looping
var counter = 0

//add all the features to an array
var fs_arr = []
for(var f in fs) {
    var c = Dictionary('BEGIN_CLASSIFICATION',`${f.BEGIN_CLASSIFICATION}`,'BEGIN_DATE_TIME',`${f.BEGIN_DATE_TIME}`,'END_CLASSIFICATION',`${f.END_CLASSIFICATION}`,'END_DATE_TIME',`${f.END_DATE_TIME}`)
    Push(fs_arr, c)
}
console (fs_arr)
return fs_arr&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for the help&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 16:01:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/compare-multiple-features-fields-to-create-string/m-p/1494456#M59759</guid>
      <dc:creator>SpatialSean</dc:creator>
      <dc:date>2024-06-18T16:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Compare multiple features fields to create string | Popup/Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/compare-multiple-features-fields-to-create-string/m-p/1494671#M59767</link>
      <description>&lt;P&gt;I figured it out, took a bit but for anyone else that needs info here was the final&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// grab the ID of the storm and filter features
var id = $feature.STORM_ID;
var fs = Filter(FeatureSetByName($map, 'Tropical_WOM', ['BEGIN_CLASSIFICATION', 'BEGIN_DATE_TIME', 'END_CLASSIFICATION', 'END_DATE_TIME']), 'STORM_ID = &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/354972"&gt;@ID&lt;/a&gt;');

// Initialize an array to hold unique classifications
var uniqueClassifications = [];

// Function to format the date and time
function formatDateTime(dateTime) {
   return Text(dateTime, 'MMMM DD, YY hh:mma');
}

// Initialize previous classification as empty
var prevClassification = '';

// Loop through the features using a for loop
for (var f in fs) {
   var beginClass = f.BEGIN_CLASSIFICATION;
   var endClass = f.END_CLASSIFICATION;
   var beginTime = formatDateTime(f.BEGIN_DATE_TIME);
   var endTime = formatDateTime(f.END_DATE_TIME);
   // Check if the current classification is different from the previous one
   if (beginClass != prevClassification) {
       // Add the classification and begin time to the array
       Push(uniqueClassifications, (beginClass + ': ' + beginTime));
   }
   // If the end classification is different from the begin classification, add it as well
   if (endClass != beginClass) {
       Push(uniqueClassifications, (endClass + ': ' + endTime));
   }
   // Update the previous classification
   prevClassification = endClass;
}

// Join the classifications with the arrow symbol to create the final string
var finalString = Concatenate(uniqueClassifications,' → ')
// Return the final string
return finalString;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 18 Jun 2024 21:34:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/compare-multiple-features-fields-to-create-string/m-p/1494671#M59767</guid>
      <dc:creator>SpatialSean</dc:creator>
      <dc:date>2024-06-18T21:34:15Z</dc:date>
    </item>
  </channel>
</rss>

