<?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 code works in Test but not in the map in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-code-works-in-test-but-not-in-the-map/m-p/1032337#M38743</link>
    <description>&lt;P&gt;I would start by making it a bit simpler:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var evalID = $feature.EvaluationID
var sql = "SpeciesEvaluationID = @evalID";  // automatically takes care of the right syntax
var tbl = Filter(FeatureSetByName($map, "VegSpecies", ['*'], false), sql);
var speciesList = [];  // Make this a list
var oneRow = [];
for (var species in tbl) {
    // Handle both attributes at the same time
    oneRow = Split(species.RightBankNoxiousCommonName + ',' + species.LeftBankNoxiousCommonName, ',');
    for (var i in oneRow) {
        speciesList[Count(speciesList)] = oneRow[i];  // Just append every found species
    }
}
return Concatenate(Distinct(speciesList), ', ')  // Extract unique species and concatenate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In ArcGIS Pro, both your code and my simplification work. Do you get an error message?&lt;/P&gt;</description>
    <pubDate>Wed, 03 Mar 2021 08:21:08 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2021-03-03T08:21:08Z</dc:date>
    <item>
      <title>Arcade code works in Test but not in the map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-code-works-in-test-but-not-in-the-map/m-p/1032011#M38733</link>
      <description>&lt;P&gt;I have some Arcade code that is working in test mode but then does not work in the popup or attribute table.&lt;/P&gt;&lt;P&gt;Test works&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DougBrowning_0-1614703055847.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/7290iFB89C31B5D3299AF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DougBrowning_0-1614703055847.png" alt="DougBrowning_0-1614703055847.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Popup is blank&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DougBrowning_1-1614703085284.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/7291iB530043F2BD81F4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DougBrowning_1-1614703085284.png" alt="DougBrowning_1-1614703085284.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and attribute table gives a data error&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DougBrowning_2-1614703166563.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/7292i657A516F2A2D7829/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DougBrowning_2-1614703166563.png" alt="DougBrowning_2-1614703166563.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;That means my code works but there is some other issue.&amp;nbsp; ArcPro does not like it either.&lt;/P&gt;&lt;P&gt;Here is the code.&amp;nbsp; I am trying to create a unique list across multiple fields and repeats from a 123 form.&amp;nbsp; It is also a select multiple so the data is 1,2,3,4 etc.&amp;nbsp; That makes the code pretty messy but it does work.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sql = "SpeciesEvaluationID = '" + $feature.EvaluationID + "'";
var tbl = Filter(FeatureSetByName($map,"VegSpecies", ['*'], false), sql);
var speciesList = '';
var oneRow = [];
for (var species in tbl) {
    oneRow = Split(species.RightBankNoxiousCommonName, ',')
    for (var i in oneRow) {
        if (!IsEmpty(oneRow[i]) &amp;amp;&amp;amp; Find(oneRow[i], speciesList) == -1) {
            speciesList += oneRow[i]  + ', ';
        }   
    }
    oneRow = Split(species.LeftBankNoxiousCommonName, ',')
    for (var i in oneRow) {
        if (!IsEmpty(oneRow[i]) &amp;amp;&amp;amp; Find(oneRow[i], speciesList) == -1) {
            speciesList += oneRow[i]  + ', ';
        }   
    }

}
return speciesList&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open to any ideas.&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 17:50:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-code-works-in-test-but-not-in-the-map/m-p/1032011#M38733</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-03-02T17:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade code works in Test but not in the map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-code-works-in-test-but-not-in-the-map/m-p/1032337#M38743</link>
      <description>&lt;P&gt;I would start by making it a bit simpler:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var evalID = $feature.EvaluationID
var sql = "SpeciesEvaluationID = @evalID";  // automatically takes care of the right syntax
var tbl = Filter(FeatureSetByName($map, "VegSpecies", ['*'], false), sql);
var speciesList = [];  // Make this a list
var oneRow = [];
for (var species in tbl) {
    // Handle both attributes at the same time
    oneRow = Split(species.RightBankNoxiousCommonName + ',' + species.LeftBankNoxiousCommonName, ',');
    for (var i in oneRow) {
        speciesList[Count(speciesList)] = oneRow[i];  // Just append every found species
    }
}
return Concatenate(Distinct(speciesList), ', ')  // Extract unique species and concatenate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In ArcGIS Pro, both your code and my simplification work. Do you get an error message?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 08:21:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-code-works-in-test-but-not-in-the-map/m-p/1032337#M38743</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-03-03T08:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade code works in Test but not in the map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-code-works-in-test-but-not-in-the-map/m-p/1032421#M38748</link>
      <description>&lt;P&gt;After more testing it is kinda working in Pro.&amp;nbsp; It will not display on screen in a layout but when we run data driven pages it does work.&lt;/P&gt;&lt;P&gt;Also it is working in the pop up in Map Viewer Beta&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DougBrowning_0-1614782024382.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/7406iC95FFE1BBBAB964F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DougBrowning_0-1614782024382.png" alt="DougBrowning_0-1614782024382.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Map beta attribute table does not seem to show Arcade at all as an option - weird.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then tried your code and same deal.&amp;nbsp; I had got rid of arrays just in case.&amp;nbsp; Works in Test but not the popup (blank) or table (data error) in regular map viewer.&lt;/P&gt;&lt;P&gt;My guess is that it is timing out or something.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 15:03:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-code-works-in-test-but-not-in-the-map/m-p/1032421#M38748</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-03-03T15:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade code works in Test but not in the map</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-code-works-in-test-but-not-in-the-map/m-p/1033139#M38797</link>
      <description>&lt;P&gt;I got another one today doing the same thing.&amp;nbsp; Works in Test and in Pro but not the popup or in the attribute table.&lt;/P&gt;&lt;P&gt;Seems like a timeout to me?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var evalID = $feature.EvaluationID
var sql = "HumanEvaluationID = @evalID";  // automatically takes care of the right syntax
var tbl = Filter(FeatureSetByName($map, "HumanInfluence", ['*'], false), sql);
var arrayIndex = 0
var humanList = []
for (var row in tbl) {
    if (row.RowCrops != "Absent") {
        humanList[arrayIndex] = "RowCrops"
        ++arrayIndex
    }
        if (row.PastureHayFence!="Absent") {
        humanList[arrayIndex] = "PastureHayFence"
        ++arrayIndex
    }
    if (row.InstreamRestoration!="Absent") {
        humanList[arrayIndex] = "InstreamRestoration"
        ++arrayIndex
    }
    if (row.LivestockHorseBurro!="Absent") {
        humanList[arrayIndex] = "LivestockHorseBurro"
        ++arrayIndex
    }
    if (row.Mining!="Absent") {
        humanList[arrayIndex] = "Mining"
        ++arrayIndex
    }
    if (row.Recreation!="Absent") {
        humanList[arrayIndex] = "Recreation"
        ++arrayIndex
    }
    if (row.LoggingOperations!="Absent") {
        humanList[arrayIndex] = "LoggingOperations"
        ++arrayIndex
    }
    if (row.WallDikeRipRap!="Absent") {
        humanList[arrayIndex] = "WallDikeRipRap"
        ++arrayIndex
    }
    if (row.BuildingsPowerlines!="Absent") {
        humanList[arrayIndex] = "BuildingsPowerlines"
        ++arrayIndex
    }
    if (row.PavementClearedLot!="Absent") {
        humanList[arrayIndex] = "PavementClearedLot"
        ++arrayIndex
    }
    if (row.RoadRailroadCulvert!="Absent") {
        humanList[arrayIndex] = "RoadRailroadCulvert"
        ++arrayIndex
    }
    if (row.Pipes!="Absent") {
        humanList[arrayIndex] = "Pipes"
        ++arrayIndex
    }
    if (row.HydrologicAlterations!="Absent") {
        humanList[arrayIndex] = "HydrologicAlterations"
        ++arrayIndex
    }
    if (row.LandfillTrash!="Absent") {
        humanList[arrayIndex] = "LandfillTrash"
        ++arrayIndex
    }
    if (row.ParksLawns!="Absent") {
        humanList[arrayIndex] = "ParksLawns"
        ++arrayIndex
    }
}
return Concatenate(Distinct(Sort(humanList)), ', ') &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;thanks&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:34:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-code-works-in-test-but-not-in-the-map/m-p/1033139#M38797</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-03-04T21:34:17Z</dc:date>
    </item>
  </channel>
</rss>

