<?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: Arcade dictionary to FeatureSet in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1056225#M5867</link>
    <description>&lt;P&gt;Glad it was a quick find and helped out!&lt;/P&gt;</description>
    <pubDate>Mon, 10 May 2021 15:17:25 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-05-10T15:17:25Z</dc:date>
    <item>
      <title>Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1047117#M5820</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to convert a dictionary to a FeatureSet in an Arcade data Expression. Everything works well until I use a Date field.&lt;/P&gt;&lt;P&gt;The following works ok, just inserting null values for the date field&lt;/P&gt;&lt;PRE&gt;var data_dict = {&lt;BR /&gt;'fields': [&lt;BR /&gt;{'name': 'EditDate','type': 'esriFieldTypeDate'},&lt;BR /&gt;{'name': 'country','type': 'esriFieldTypeString'},&lt;BR /&gt;{'name': 'status','type': 'esriFieldTypeInteger'}&lt;BR /&gt;],&lt;BR /&gt;'geometryType':'',&lt;BR /&gt;'features': []&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;for (var i=0; i &amp;lt; 10;i++) {&lt;BR /&gt;data_dict.features[i] = {&lt;BR /&gt;'attributes': {&lt;BR /&gt;'EditDate': null,&lt;BR /&gt;'country': 'NL',&lt;BR /&gt;'status': 230&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;Console(data_dict)&lt;BR /&gt;var fs = FeatureSet(Text(data_dict))&lt;BR /&gt;return fs&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It results in a FeatureSet with empty values for the date field and all other field filled.&lt;/P&gt;&lt;P&gt;However, if I try Now() or Text(Now(),"YYYY-MM-DD") or Timestamp() or just a date like string '2021-04-14' :&lt;/P&gt;&lt;PRE&gt;var data_dict = {&lt;BR /&gt;'fields': [&lt;BR /&gt;{'name': 'EditDate','type': 'esriFieldTypeDate'},&lt;BR /&gt;{'name': 'country','type': 'esriFieldTypeString'},&lt;BR /&gt;{'name': 'status','type': 'esriFieldTypeInteger'}&lt;BR /&gt;],&lt;BR /&gt;'geometryType':'',&lt;BR /&gt;'features': []&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;for (var i=0; i &amp;lt; 10;i++) {&lt;BR /&gt;data_dict.features[i] = {&lt;BR /&gt;'attributes': {&lt;BR /&gt;'EditDate': Now(),&lt;BR /&gt;'country': 'NL',&lt;BR /&gt;'status': 230&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;Console(data_dict)&lt;BR /&gt;var fs = FeatureSet(Text(data_dict))&lt;BR /&gt;return fs&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I end up with an empty Featureset&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Marc&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 16:59:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1047117#M5820</guid>
      <dc:creator>MarcHoogerwerf_TAP</dc:creator>
      <dc:date>2021-04-14T16:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1048379#M5824</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/414732"&gt;@MarcHoogerwerf_TAP&lt;/a&gt;&amp;nbsp;- the date field is looking for a UNIX timestamp, which you can create in Arcade with &lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#datediff" target="_blank" rel="noopener"&gt;DateDiff().&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var start = ToLocal(Date(1970, 0, 01, 0, 0, 0, 0))
var dt = DateDiff(Now(), start, 'milliseconds')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;-Peter&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 23:32:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1048379#M5824</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-04-16T23:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1048404#M5825</link>
      <description>&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;Brilliant! It works now. Thanks&lt;/P&gt;&lt;P&gt;- Marc&lt;/P&gt;</description>
      <pubDate>Sat, 17 Apr 2021 04:54:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1048404#M5825</guid>
      <dc:creator>MarcHoogerwerf_TAP</dc:creator>
      <dc:date>2021-04-17T04:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1056039#M5865</link>
      <description>&lt;P&gt;@Anonymous User&amp;nbsp;was scratching my head for a while on this, after a quick google it led me here - thanks for your solution.&lt;/P&gt;</description>
      <pubDate>Sun, 09 May 2021 17:27:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1056039#M5865</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-05-09T17:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1056225#M5867</link>
      <description>&lt;P&gt;Glad it was a quick find and helped out!&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 15:17:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1056225#M5867</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-05-10T15:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1129588#M6116</link>
      <description>&lt;P&gt;This is great, i have been struggling with this for over a day.&amp;nbsp; Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 23:07:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1129588#M6116</guid>
      <dc:creator>DarrylKlassen1</dc:creator>
      <dc:date>2021-12-29T23:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1235931#M6426</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User, I'm tying to figure out where I would assign the "dt" variable within my dictionary. See Expression below. I'm having the same issue, in which the "CloseOutDate" field is not populating.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var portal = Portal("https://cms.maps.arcgis.com/"); 

var TandJSoft = FeatureSetByPortalItem(portal,"c6366ef0c8424130a76e9e9d08f292de",0,["*"],false); 

var JWSoft = FeatureSetByPortalItem(portal,"92497f50542248dcb798d091dd18d004",0,["*"],false); 

var start = ToLocal(Date(1970,0,01,0,0,0,0))

var dt = DateDiff(Now(), start, 'milliseconds')

var combinedDict = { 
  'fields': [ 
    { name: "Contractor", type:"esriFieldTypeString" },
    { name: "Total", type: "esriFieldTypeDouble" },
    { name: "Address", type: "esriFieldTypeString" }, 
    { name: "ProjectName", type: "esriFieldTypeString" },
    {name: "Status", type: "esriFieldTypeString" },
    {name: "CloseOutDate", type: "esriFieldTypeDate" },
  ], 
  geometryType: "", 
  features: [], 
};

var i = 0; 
// Loop through each FeatureSet and store its attributes 
for (var t in TandJSoft) { 
  combinedDict.features[i++] = { 
    attributes: {
      Contractor: t["Contractor"],
      Total: t["Total"],
      Address: t["Address"], 
      ProjectName: t["ProjectName"],
      Status: t["Status"],
      CloseOutDate: t["CloseOutDate"],
    }, 
  }; 
} 

for (var m in JWSoft) { 
  combinedDict.features[i++] = { 
    attributes: { 
      Contractor: m["Contractor"],
      Total: m["Total"],
      Address: m["Address"], 
      ProjectName: m["ProjectName"],
      Status: m["Status"],
      CloseOutDate: m["CloseOutDate"],
    }, 
  }; 
}

// Return dictionary cast as a FeatureSet  
return FeatureSet(Text(combinedDict));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 15:38:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1235931#M6426</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-11-29T15:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1238550#M6437</link>
      <description>&lt;P&gt;@Anonymous User&amp;nbsp;you can remove the variable line 'var dt = ...' completely as you're not wanting to get the date diff for Now(), as that's the current date at time of execution, instead you'll use your field value date to replace the Now(). For each of the date fields, in each featureset update them to the following but change the feature variable to be relevant i.e. t or m:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;CloseOutDate: DateDiff(t["CloseOutDate"], start, 'milliseconds')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 23:53:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1238550#M6437</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-12-06T23:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1238552#M6438</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;what's the method for using an existing date field, coming from an exisitng FeatureSet, in a dictionary i.e. @Anonymous User's post below?&lt;/P&gt;&lt;P&gt;Having to do a DateDiff for each date field seems overly complicated. I'm guessing there are some smarts whereby the date field is automatically being converted to text on execution, instead of an epoch as the example from this page (below)&amp;nbsp;&lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#date" target="_blank"&gt;https://developers.arcgis.com/arcade/function-reference/date_functions/#date&lt;/A&gt;&amp;nbsp;doesn't work:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var recordDate = Date($feature.dateField)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 00:02:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1238552#M6438</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-12-07T00:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1238999#M6439</link>
      <description>&lt;P&gt;That did the trick! Thanks so much for the help.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 02:19:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1238999#M6439</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-12-08T02:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1280219#M6565</link>
      <description>&lt;P&gt;This was a huge help, the problem I was then running into was in using data from Survey123 it did not have the time zone correct and I could not figure out why.&lt;/P&gt;&lt;P&gt;I ended up using Number() around my date and it worked out, but I'm curious about the time zone issues I had with DateDiff. Even with Now() it is off by -4 hours, I'm in ADT (-3) which is (-4) when AST. Survey123 is right but the dashboard seems to compensate a second time?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 15:02:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1280219#M6565</guid>
      <dc:creator>RobertAnderson3</dc:creator>
      <dc:date>2023-04-19T15:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1299929#M6639</link>
      <description>&lt;P&gt;With this week's update to Arcade and ArcGIS Dashboards, date fields in feature set constructors now just work. You no longer have to wrap dates with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Number()&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if you pass the &lt;EM&gt;dictionary&lt;/EM&gt; into the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;FeatureSet()&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function (which as of this release accepts a dictionary as opposed to only text based JSON).&lt;/P&gt;&lt;P&gt;Instead of:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(Text(dict))&lt;/PRE&gt;&lt;P&gt;Do this:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(dict)&lt;/PRE&gt;&lt;P&gt;Learn more in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-dashboards-blog/dashboard-data-expressions-what-has-changed-june/ba-p/1298782" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;NOTE: For Enterprise users, this update is targeted for 11.2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 19:22:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1299929#M6639</guid>
      <dc:creator>DavidNyenhuis1</dc:creator>
      <dc:date>2023-06-15T19:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade dictionary to FeatureSet</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1299941#M6640</link>
      <description>&lt;P&gt;With this week's update to Arcade and ArcGIS Dashboards, date fields in feature set constructors now just work. You no longer have to pass dates in as EPOCH&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if you pass the &lt;EM&gt;dictionary&lt;/EM&gt; into the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;FeatureSet()&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function (which as of this release accepts a dictionary as opposed to only text based JSON).&lt;/P&gt;&lt;P&gt;Instead of:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(Text(dict))&lt;/PRE&gt;&lt;P&gt;Do this:&lt;/P&gt;&lt;PRE&gt;return FeatureSet(dict)&lt;/PRE&gt;&lt;P&gt;Learn more in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-dashboards-blog/dashboard-data-expressions-what-has-changed-june/ba-p/1298782" target="_blank" rel="noopener"&gt;this blog post&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;NOTE: For Enterprise users, this update is targeted for 11.2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 19:30:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/m-p/1299941#M6640</guid>
      <dc:creator>DavidNyenhuis1</dc:creator>
      <dc:date>2023-06-15T19:30:27Z</dc:date>
    </item>
  </channel>
</rss>

