<?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 list values from field in related table in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1554504#M62192</link>
    <description>&lt;P&gt;Super helpful; got a version working for myself in 5 min. Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2024 20:18:12 GMT</pubDate>
    <dc:creator>AlderMaps</dc:creator>
    <dc:date>2024-10-31T20:18:12Z</dc:date>
    <item>
      <title>Arcade expression to list values from field in related table</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1292695#M52424</link>
      <description>&lt;P&gt;Hi -&lt;/P&gt;&lt;P&gt;I am still new to Arcade.&amp;nbsp; I have created the below script in AGO Map Viewer Forms that joins to a related table with a one to many relationship based upon Project ID, and pulls the Phase IDs into a field in the Projects layer with each ID separated by ", ". The script is working, but it adds a comma and space after the last PHASE ID (which makes sense based on the code), but I would prefer not to have the comma and space at the end. I have tried adding Replace and Right functions to remove them, but haven't been successful. Any recommendations of how to alter the code to remove the comma and space at the end or prevent them from being added?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Leila&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var related_table = FeatureSetById($datastore, /* SNP_PHASE */ "0");&lt;/P&gt;&lt;P&gt;var filter_query = "PROJECTID = '" + $feature["PROJECTID"] + "'";&lt;/P&gt;&lt;P&gt;var related_data_filtered = Filter(related_table, filter_query);&lt;/P&gt;&lt;P&gt;var related_data_filtered_count = Count(related_data_filtered);&lt;/P&gt;&lt;P&gt;var output = "";&lt;/P&gt;&lt;P&gt;if (related_data_filtered_count &amp;gt; 0) {for (var related_data_row in related_data_filtered) {output += related_data_row.PH_PHASEID &amp;nbsp;+ TextFormatting.NewLine;}}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else {output = "No Related Records.";}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 17:43:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1292695#M52424</guid>
      <dc:creator>LJackson29</dc:creator>
      <dc:date>2023-05-24T17:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to list values from field in related table</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1292710#M52425</link>
      <description>&lt;P&gt;Instead of building an &lt;STRONG&gt;output&lt;/STRONG&gt; string, use an array together with the &lt;STRONG&gt;Concatenate&lt;/STRONG&gt; function.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var related_table = FeatureSetById($datastore, /* SNP_PHASE */ "0");

var filter_query = "PROJECTID = '" + $feature["PROJECTID"] + "'";

var related_data_filtered = Filter(related_table, filter_query);

var related_data_filtered_count = Count(related_data_filtered);

var output = []

if (related_data_filtered_count &amp;gt; 0) {
  for (var related_data_row in related_data_filtered) {
    Push(output, related_data_row.PH_PHASEID)
  }
} else {
  return "No Related Records."
}

return Concatenate(output, ', ')&lt;/LI-CODE&gt;&lt;P&gt;This will insert the comma and space only &lt;EM&gt;between &lt;/EM&gt;items in your output array, nothing at the end.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 18:07:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1292710#M52425</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-05-24T18:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to list values from field in related table</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1292742#M52427</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;That worked perfectly - many thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 18:57:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1292742#M52427</guid>
      <dc:creator>LJackson29</dc:creator>
      <dc:date>2023-05-24T18:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to list values from field in related table</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1554504#M62192</link>
      <description>&lt;P&gt;Super helpful; got a version working for myself in 5 min. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 20:18:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1554504#M62192</guid>
      <dc:creator>AlderMaps</dc:creator>
      <dc:date>2024-10-31T20:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression to list values from field in related table</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1586641#M63678</link>
      <description>&lt;P&gt;How do you use this as a dropdown for a particular field within a form?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 21:16:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-to-list-values-from-field-in/m-p/1586641#M63678</guid>
      <dc:creator>ahargreaves_FW</dc:creator>
      <dc:date>2025-02-18T21:16:46Z</dc:date>
    </item>
  </channel>
</rss>

