<?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: Error in Filter when creating Arcade Data Expression in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/error-in-filter-when-creating-arcade-data/m-p/1273551#M7558</link>
    <description>&lt;P&gt;Is op_record_id field a string field or numeric? If it's a string, you'll need quotes. Or you can avoid that by using @variable&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var TableID = Text(t["op_record_id"]);
for (var p in Filter(pointFS,"op_record_id = @TableID")){&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 30 Mar 2023 14:20:02 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2023-03-30T14:20:02Z</dc:date>
    <item>
      <title>Error in Filter when creating Arcade Data Expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/error-in-filter-when-creating-arcade-data/m-p/1273544#M7557</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a Data Expression within my dashboard to access some related records. I've set up a filter to access the data but am getting an error when trying to access the data from the Filter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;Test execution error: Unknown Error. Verify test data."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've added a few console outputs to test my results. I am able to get the output for the first console statement but then run into the error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've added the relevant portion of the script below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var portalServ = Portal("https://www.arcgis.com/");
var pointFS = FeatureSetByPortalItem(
  portalServ,
  "featID",
  0,
  ["*"],
  False
);

var tablefs = FeatureSetByPortalItem(
  portalServ,
  "featID",
  1,
  ["*"],
  False
);


var features = [];
var feat;
var calls_sub_found_var;

for (var t in tablefs){
  var TableID = t["op_record_id"]
  console(TableID);
  for (var p in Filter(pointFS,"op_record_id = "+Text(TableID))){
    console(p["op_record_id"]);
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additionally, if I use the console to output the Filter object itself, I am able to return that. It is only when I try and start accessing the objects from the filter when I run into the error.&lt;/P&gt;&lt;P&gt;Would the amount of data be a factor in the filter failing? I'm working with ~120k point features and ~20k related records in total.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 14:09:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/error-in-filter-when-creating-arcade-data/m-p/1273544#M7557</guid>
      <dc:creator>ZachLansford_HD</dc:creator>
      <dc:date>2023-03-30T14:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Filter when creating Arcade Data Expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/error-in-filter-when-creating-arcade-data/m-p/1273551#M7558</link>
      <description>&lt;P&gt;Is op_record_id field a string field or numeric? If it's a string, you'll need quotes. Or you can avoid that by using @variable&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var TableID = Text(t["op_record_id"]);
for (var p in Filter(pointFS,"op_record_id = @TableID")){&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Mar 2023 14:20:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/error-in-filter-when-creating-arcade-data/m-p/1273551#M7558</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-03-30T14:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Filter when creating Arcade Data Expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/error-in-filter-when-creating-arcade-data/m-p/1273554#M7559</link>
      <description>&lt;P&gt;It is a string field - this solved my issue. Thanks a bunch!&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 14:23:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/error-in-filter-when-creating-arcade-data/m-p/1273554#M7559</guid>
      <dc:creator>ZachLansford_HD</dc:creator>
      <dc:date>2023-03-30T14:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Filter when creating Arcade Data Expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/error-in-filter-when-creating-arcade-data/m-p/1273556#M7560</link>
      <description>&lt;P&gt;When you return the filtered object, what does it look like?&lt;/P&gt;&lt;P&gt;When I write a filter statement, I prefer to use &lt;STRONG&gt;template literals&lt;/STRONG&gt;:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Filter(pointFS,`op_record_id = ${TableID}`)&lt;/LI-CODE&gt;&lt;P&gt;In general, when you're working with a filtered FeatureSet, you ought to include an if statement that checks to see that there &lt;EM&gt;are &lt;/EM&gt;any features. Expressions can sometimes break when they attempt to work with a FeatureSet that has nothing in it.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var filtered = Filter(...)

if (Count(filtered) &amp;gt; 0) {
  for (var p in filtered) {
    ...
  }
}&lt;/LI-CODE&gt;&lt;P&gt;Is there a real relationship class between the layers? Why not use &lt;STRONG&gt;FeatureSetByRelationShipName&lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 14:29:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/error-in-filter-when-creating-arcade-data/m-p/1273556#M7560</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-03-30T14:29:36Z</dc:date>
    </item>
  </channel>
</rss>

