<?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: Constraint Rule to Prevent Deleting of Features in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088460#M168</link>
    <description>&lt;P&gt;The if statement is an invalid syntax. You are comparing a feature (first(fsResult)) to a value $originalfeature.cab_id. Plus don't use IN, use == instead and compare the actual values&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That being said,&amp;nbsp;I'm not sure what the rule is trying to do, maybe provide a brief description of what the rule is suppose to do? Going by your statement if you want to prevent deletion of features it is a matter of simply creating a constraint rule that returns false.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;return false;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Aug 2021 15:19:18 GMT</pubDate>
    <dc:creator>HusseinNasser2</dc:creator>
    <dc:date>2021-08-12T15:19:18Z</dc:date>
    <item>
      <title>Constraint Rule to Prevent Deleting of Features</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088409#M164</link>
      <description>&lt;P&gt;Hello, I am trying to write a rule that will prevent the deletion of features in an fc. I'm getting the error 'Invalid expression. Close parenthesis expected' but I don't know why. Here is what I have so far.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var currentAssetId = $feature.cab_id
var fsMyClass = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries_copy")
var fsResult = filter(fsMyClass, "cab_id = @currentAssetId")

if (first(fsResult) IN $originalfeature.cab_id)

return true;
else
return false; &lt;/LI-CODE&gt;&lt;P&gt;I believe the problem is in the if statement but I don't know what would be wrong here.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 14:24:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088409#M164</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-08-12T14:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint Rule to Prevent Deleting of Features</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088420#M165</link>
      <description>&lt;P&gt;Just a shot in the dark, but don't you need to enclose things in curly braces?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (first(fsResult) IN $originalfeature.cab_id){
    return true;
}else{
    return false; 
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 12 Aug 2021 14:34:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088420#M165</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-08-12T14:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint Rule to Prevent Deleting of Features</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088422#M166</link>
      <description>&lt;P&gt;I tried this while troubleshooting before posting, but unfortunately this doesn't clear the error. Thanks for taking a look.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 14:38:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088422#M166</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-08-12T14:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint Rule to Prevent Deleting of Features</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088429#M167</link>
      <description>&lt;P&gt;Rats...&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 14:47:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088429#M167</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-08-12T14:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint Rule to Prevent Deleting of Features</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088460#M168</link>
      <description>&lt;P&gt;The if statement is an invalid syntax. You are comparing a feature (first(fsResult)) to a value $originalfeature.cab_id. Plus don't use IN, use == instead and compare the actual values&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That being said,&amp;nbsp;I'm not sure what the rule is trying to do, maybe provide a brief description of what the rule is suppose to do? Going by your statement if you want to prevent deletion of features it is a matter of simply creating a constraint rule that returns false.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;return false;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 15:19:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088460#M168</guid>
      <dc:creator>HusseinNasser2</dc:creator>
      <dc:date>2021-08-12T15:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint Rule to Prevent Deleting of Features</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088468#M169</link>
      <description>&lt;P&gt;Good catch...&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 15:27:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088468#M169</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-08-12T15:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint Rule to Prevent Deleting of Features</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088485#M170</link>
      <description>&lt;P&gt;Wow so simple, that's great. Thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 15:39:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-prevent-deleting-of-features/m-p/1088485#M170</guid>
      <dc:creator>ChrisGAEG</dc:creator>
      <dc:date>2021-08-12T15:39:54Z</dc:date>
    </item>
  </channel>
</rss>

