<?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 only input text formatted as ##-#####-## in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-only-input-text-formatted-as/m-p/1100390#M237</link>
    <description>&lt;P&gt;Thank you!&amp;nbsp; I did not think to use replace in a calculation.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Sep 2021 16:16:35 GMT</pubDate>
    <dc:creator>NikeshPatel</dc:creator>
    <dc:date>2021-09-21T16:16:35Z</dc:date>
    <item>
      <title>Constraint rule to only input text formatted as ##-#####-##</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-only-input-text-formatted-as/m-p/1099091#M221</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I've been struggling to find a reference to enable a constraint attribute rule that only allows users to input&amp;nbsp; text as "##-#####-##" for a specific text field. I'm happy to have the user input this manually or have the dashes automatically put in.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I tried the below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;text($feature.accountname, '##-#####-##')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm avoiding creating a new field to perform a calculation rule as I can't really change the schema at this current time due to connected services.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Would appreciate any and all help&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 20:15:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-only-input-text-formatted-as/m-p/1099091#M221</guid>
      <dc:creator>NikeshPatel</dc:creator>
      <dc:date>2021-09-16T20:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint rule to only input text formatted as ##-#####-##</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-only-input-text-formatted-as/m-p/1099793#M230</link>
      <description>&lt;P&gt;Don't do it as constraint rule, but as calculation rule on accountname:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation attribute rule
// Field acccountname
// Triggers: Insert, Update
if(IsEmpty($feature.accountname)) {
  return null
}
var input = Replace($feature.accountname, "-", "")
return Left(input, 2) + "-" + Mid(input, 2, 5) + "-" + Right(input, 2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To ensure that this calculates correct values, you can do a constraint rule that checks for the length of the string:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Constraint attribute rule
// rejects the edit if there are not exactly 9 characters
var input = Replace($feature.accountname, "-", "")
return Count(input) == 9&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 20 Sep 2021 06:47:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-only-input-text-formatted-as/m-p/1099793#M230</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-09-20T06:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint rule to only input text formatted as ##-#####-##</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-only-input-text-formatted-as/m-p/1100390#M237</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; I did not think to use replace in a calculation.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 16:16:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/constraint-rule-to-only-input-text-formatted-as/m-p/1100390#M237</guid>
      <dc:creator>NikeshPatel</dc:creator>
      <dc:date>2021-09-21T16:16:35Z</dc:date>
    </item>
  </channel>
</rss>

