<?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: tested successfully in webmap but get error in attribute rules in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/tested-successfully-in-webmap-but-get-error-in/m-p/1017246#M74</link>
    <description>&lt;P&gt;Thank you. Now it validates in ArcGIS Pro- I also added a line to check for a valid value before populating the record. Now I will test that it works in the Collector app.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jan 2021 15:33:33 GMT</pubDate>
    <dc:creator>JuneAcosta</dc:creator>
    <dc:date>2021-01-15T15:33:33Z</dc:date>
    <item>
      <title>tested successfully in webmap but get error in attribute rules</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/tested-successfully-in-webmap-but-get-error-in/m-p/1015801#M62</link>
      <description>&lt;P&gt;This script runs successfully when I test in the webmap against the service- see the attached image.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-01-11_15-02-39.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3609i79A01563B69B2D31/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-01-11_15-02-39.jpg" alt="2021-01-11_15-02-39.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, I get an error once I try to use in&amp;nbsp; attribute rules using ArcPro 2.7.x. I'm new to attribute rules, and will appreciate any help folks on this forum.&lt;/P&gt;&lt;P&gt;I have a liftstation featureclass with a related table for repeat inspections using collector. I need a rule that will populated the station name from the liftstation featureclass to a field in the related table.&lt;/P&gt;&lt;P&gt;I get the error "Invalid expression Error on line 6 General evaluation error" . It's failing at the line "{&lt;BR /&gt;output += related_row.STATIONNAME"}&lt;/P&gt;&lt;P&gt;Here's the code used in attribute rules.&lt;/P&gt;&lt;P&gt;//get the guid of the table feature being updated&lt;BR /&gt;var filter_query = "GlobalID = '" + $feature.LStationID +"'"&lt;/P&gt;&lt;P&gt;//find the lift station layer&lt;BR /&gt;//$datastore is the current geodatabase&lt;BR /&gt;//get the GlobalId and STATIONNAME field&lt;BR /&gt;var related_fs = FeatureSetByName($datastore, 'gisdmz.SDECB.wwLiftStation',['GlobalID','STATIONNAME'])&lt;/P&gt;&lt;P&gt;//get the guid of the table feature being updated&lt;BR /&gt;var filter_query = "GlobalID = '" + $feature.LStationID +"'"&lt;/P&gt;&lt;P&gt;//find the station by filtering on the Guid&lt;BR /&gt;var related_filter = Filter(related_fs, filter_query)&lt;/P&gt;&lt;P&gt;var output = ''&lt;BR /&gt;for (var related_row in related_filter){&lt;BR /&gt;output += related_row.STATIONNAME&lt;BR /&gt;}&lt;BR /&gt;return {&lt;BR /&gt;"result": output&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 23:45:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/tested-successfully-in-webmap-but-get-error-in/m-p/1015801#M62</guid>
      <dc:creator>JuneAcosta</dc:creator>
      <dc:date>2021-01-11T23:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: tested successfully in webmap but get error in attribute rules</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/tested-successfully-in-webmap-but-get-error-in/m-p/1016611#M67</link>
      <description>&lt;P&gt;Hard to tell from the script whats going on, but I modified the script to be more readable and less error prune by using the inline sql semantics so it takes care things for us like adding single quotes or dates predicates&lt;/P&gt;&lt;P&gt;You get the error on that line because thats when Arcade actually executes the query filter, make sure that the stationId is actually a valid globalId.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//get the guid of the table feature being updated
var lstationId = $feature.LStationID;
var filter_query = "GlobalID = @lstationId";

//find the lift station layer
//$datastore is the current geodatabase
//get the GlobalId and STATIONNAME field
var related_fs = FeatureSetByName($datastore, 'gisdmz.SDECB.wwLiftStation',['GlobalID','STATIONNAME'])

//get the guid of the table feature being updated
var filter_query = "GlobalID = @lstationId";

//find the station by filtering on the Guid
var related_filter = Filter(related_fs, filter_query)

var output = ''
for (var related_row in related_filter)
    output += related_row.STATIONNAME


return {
"result": output
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 13 Jan 2021 21:48:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/tested-successfully-in-webmap-but-get-error-in/m-p/1016611#M67</guid>
      <dc:creator>HusseinNasser2</dc:creator>
      <dc:date>2021-01-13T21:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: tested successfully in webmap but get error in attribute rules</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/tested-successfully-in-webmap-but-get-error-in/m-p/1017246#M74</link>
      <description>&lt;P&gt;Thank you. Now it validates in ArcGIS Pro- I also added a line to check for a valid value before populating the record. Now I will test that it works in the Collector app.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 15:33:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/tested-successfully-in-webmap-but-get-error-in/m-p/1017246#M74</guid>
      <dc:creator>JuneAcosta</dc:creator>
      <dc:date>2021-01-15T15:33:33Z</dc:date>
    </item>
  </channel>
</rss>

