<?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 Using Schema Function in Attribute Rule in ArcGIS Utility Network Questions</title>
    <link>https://community.esri.com/t5/arcgis-utility-network-questions/using-schema-function-in-attribute-rule/m-p/1338321#M2936</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm trying to add a field to the Change Log table I've created that tracks edits to our data. The new field would record the changes made to the field values of a feature and would be in dictionary format (field output would be "x field: y new field value, z field: w new field value...). I only want to record fields that have had edits made to them. Here's the code I have so far-- I'm trying to create an empty dictionary, use the Schema tool to get the field names and values, compare them, and push values to the new dictionary that are different from the original values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;var DeviceFeatureEdits = FeatureSetByName($datastore, 'ElectricDevice',['*'], true)&lt;/P&gt;&lt;P&gt;var editscalc = Dictionary()&lt;/P&gt;&lt;P&gt;//schema function returns an array of dictionaries, includes field names&lt;BR /&gt;var Cschema = Schema(DeviceFeatureEdits))&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Cschema is the post edit dictionary of field values&lt;BR /&gt;var Oschema = Schema(DeviceFeatureEdits.$originalfeature))&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Oschema is the pre-edit dictionary of field values&lt;/P&gt;&lt;P&gt;if (Oschema.assetid != Cschema.assetid){&lt;BR /&gt;push (editscalc, Cschema.assetid)&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//I repeat the above If statement for all the fields.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The lines where I use the Schema function keep causing either "semicolon or new line expected" or "reserved keyword used". Is the schema function not applicable to attribute rules, or am I using it wrong? Is this a viable way to do what I'm trying to do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 16 Oct 2023 17:39:24 GMT</pubDate>
    <dc:creator>Ariggs</dc:creator>
    <dc:date>2023-10-16T17:39:24Z</dc:date>
    <item>
      <title>Using Schema Function in Attribute Rule</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/using-schema-function-in-attribute-rule/m-p/1338321#M2936</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm trying to add a field to the Change Log table I've created that tracks edits to our data. The new field would record the changes made to the field values of a feature and would be in dictionary format (field output would be "x field: y new field value, z field: w new field value...). I only want to record fields that have had edits made to them. Here's the code I have so far-- I'm trying to create an empty dictionary, use the Schema tool to get the field names and values, compare them, and push values to the new dictionary that are different from the original values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;var DeviceFeatureEdits = FeatureSetByName($datastore, 'ElectricDevice',['*'], true)&lt;/P&gt;&lt;P&gt;var editscalc = Dictionary()&lt;/P&gt;&lt;P&gt;//schema function returns an array of dictionaries, includes field names&lt;BR /&gt;var Cschema = Schema(DeviceFeatureEdits))&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Cschema is the post edit dictionary of field values&lt;BR /&gt;var Oschema = Schema(DeviceFeatureEdits.$originalfeature))&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Oschema is the pre-edit dictionary of field values&lt;/P&gt;&lt;P&gt;if (Oschema.assetid != Cschema.assetid){&lt;BR /&gt;push (editscalc, Cschema.assetid)&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//I repeat the above If statement for all the fields.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The lines where I use the Schema function keep causing either "semicolon or new line expected" or "reserved keyword used". Is the schema function not applicable to attribute rules, or am I using it wrong? Is this a viable way to do what I'm trying to do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 17:39:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/using-schema-function-in-attribute-rule/m-p/1338321#M2936</guid>
      <dc:creator>Ariggs</dc:creator>
      <dc:date>2023-10-16T17:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using Schema Function in Attribute Rule</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/using-schema-function-in-attribute-rule/m-p/1338339#M2937</link>
      <description>&lt;P&gt;Wanted to add that trying this:&lt;/P&gt;&lt;P&gt;var Cschema = Schema($feature)&lt;BR /&gt;var Oschema = Schema($originalfeature)&lt;/P&gt;&lt;P&gt;if (Oschema.assetid != Cschema.assetid){&lt;BR /&gt;push (editscalc, Cschema.assetid)&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yields the error message "Field not found assetid"&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 18:13:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/using-schema-function-in-attribute-rule/m-p/1338339#M2937</guid>
      <dc:creator>Ariggs</dc:creator>
      <dc:date>2023-10-16T18:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using Schema Function in Attribute Rule</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/using-schema-function-in-attribute-rule/m-p/1338877#M2938</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I don't think you can get field values with the Schema function. According to the documentation, this is the result :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;fields&lt;/STRONG&gt;: &lt;A href="https://developers.arcgis.com/arcade/guide/types/#array" target="_blank" rel="noopener"&gt;Array&lt;/A&gt;&amp;lt;&lt;A href="https://developers.arcgis.com/arcade/guide/types/#dictionary" target="_blank" rel="noopener"&gt;Dictionary&lt;/A&gt;&amp;gt; - Returns an array of dictionaries describing the fields in the Feature. Each dictionary describes the field name, alias, type, subtype, domain, length, and whether it is editable and nullable.&lt;/P&gt;&lt;P&gt;Field values are not part of the result.&lt;/P&gt;&lt;P&gt;Also in the first line, DeviceFeatureEdits is a featureSet, but Schema function takes a Feature as input, not a featureSet.&lt;/P&gt;&lt;P&gt;To achieve what you want, maybe you can create a function that directly compare $feature fields and values with $originalfeature fields and values and returns a dictionary of edits. I would be interested if you succeed in.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 20:50:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/using-schema-function-in-attribute-rule/m-p/1338877#M2938</guid>
      <dc:creator>PierreloupDucroix</dc:creator>
      <dc:date>2023-10-17T20:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using Schema Function in Attribute Rule</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/using-schema-function-in-attribute-rule/m-p/1345199#M3016</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;editscalc&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;Dictionary&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;fieldarray&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;Schema&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;fields&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt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t;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DomainName&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;z&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Update with success, I was able to return the Field name and the new field value to one field to my Change Log table using the above code. The new field value is "editscalc" converted to text. I only wanted to use Schema to isolate the field names, not the values, without hard coding them.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Nov 2023 19:00:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/using-schema-function-in-attribute-rule/m-p/1345199#M3016</guid>
      <dc:creator>Ariggs</dc:creator>
      <dc:date>2023-11-02T19:00:41Z</dc:date>
    </item>
  </channel>
</rss>

