Arcade - How to use a date field with a dictionary ?

2730
9
Jump to solution
08-02-2021 09:06 PM
Labels (1)
explocarto
Regular Contributor

With the Arcade language, I try to feed a dictionary with several fields of which one field is of type date.
This dictionary is fed from a feature service.

Here is an example of my code:

explocarto_1-1627963200977.png

If I return the contents of my dictionary, I can see the date value.

explocarto_4-1627963474754.png

 

But if I try to flip it this way:

return FeatureSet(Text(table_Dict))
Date values not appearing !

explocarto_3-1627963382732.png

Can someone help me with this?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

Had the same issue. @Anonymous User  solved it for me re requirement for unix timestamp https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/td-p/1047117

 

View solution in original post

9 Replies
DavidPike
MVP Frequent Contributor

Had the same issue. @Anonymous User  solved it for me re requirement for unix timestamp https://community.esri.com/t5/developers-questions/arcade-dictionary-to-featureset/td-p/1047117

 

by Anonymous User
Not applicable

Thanks @DavidPike - I have seen this come up a lot recently with increased adoption of Data Expressions. I'm thinking I'll submit an issue to see if a date field can be included in the FeatureSet example in the Arcade documentation. 

DavidPike
MVP Frequent Contributor

I think that would be really helpful.

0 Kudos
RobertAnderson3
MVP Regular Contributor

As far as I am aware this is still not in the documentation (definitely not in the samples that the link in the Data Expression directs you to) and this would still be very helpful to include!

0 Kudos
explocarto
Regular Contributor

Thank you both. 😀

Have a nice day

MICHAELOBIDA
New Contributor

Hello pls i need a line to download and  install this on my pc ARCGIS DESKTOP

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

@MICHAELOBIDA : I would suggest you to write a new question, rather than commenting in replies to unrelated threads.

For instructions, please check How to ask a question - Esri Community 



Think Location
by Anonymous User
Not applicable

For anyone else who stumbles along this problem, here's an explanation and alternative. You can vote on this idea to hopefully get it fixed: https://community.esri.com/t5/arcgis-online-ideas/arcade-allow-date-values-in-date-fields/idc-p/1236... 

0 Kudos
DavidNyenhuis1
Esri Contributor

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 if you pass the dictionary into the FeatureSet() function (which as of this release accepts a dictionary as opposed to only text based JSON).

Instead of:

return FeatureSet(Text(dict))

Do this:

return FeatureSet(dict)

Learn more in this blog post

NOTE: For Enterprise users, this update is targeted for 11.2