Filter based on current or future dates in AGOL

6791
24
05-10-2015 03:31 PM
RobbHodges
Occasional Contributor III

Is it possible to set a filter to show outages that have yet to be completed by date? We will have a start date/time and an end date/time. I would like to hide the outages that have expired. I was thinking about creating a new yes/no field that I can filter that way, but I'd like to avoid having a user to have to go back and enter that in. I'd like to just hide the results after the completion date automatically. Can this be done?

Thanks!

0 Kudos
24 Replies
RussRoberts
Esri Notable Contributor

here is a link to the assistant: ArcGIS Online Assistant

NilsBabel
Occasional Contributor II

How have I missed this tool?  Looks very useful.  But how do I edit a web map json file?  It doesn't let me edit it in the assistant and I don't see where I could upload one anywhere.

Also, is there a rule behind some feature services that let you filter some date fields but not others?  I'm trying to set a filter on the FireOutDateTime field on this feature service:

http://irwin.doi.gov/arcgis/rest/services/Console/Incident_View/FeatureServer/0

But the date fields don't show up in the drop down of the filter interface.

Thanks for your help

0 Kudos
RussRoberts
Esri Notable Contributor

So in the tool you click "I want to view JSON" and then when you click on the map item on the left and then on the right the JSON will show up for the map and there will be an edit icon in the top right corner of the JSON and that is where you can start making edits and then click save.

NilsBabel
Occasional Contributor II

Ahh, thanks.  I missed that.  Once you start scrolling those buttons disappear.

0 Kudos
JeremyGould
New Contributor III

I still don't understand where you would put the syntax within the JSON.

Where would I put the following Example within my JSON?

DATEDIFF(s,DATEADD(s,30,CreationDate),GETDATE()) < 0

Thanks

0 Kudos
MikeMillerGIS
Esri Frequent Contributor

In the filter for the layer.  It is probably best to create some random filter on the layer.  That way the filter parameter is part of the json of the layer in the webmap.  Then use the AGO Assistant to replace the random filter with the one you want. 

Just remember the following:

  1:  The date syntax is database dependent

  2:  This is considered a non standard query, so you need to make sure you server supports non standard queries

JeremyGould
New Contributor III

Thanks, that did it.  By creating a random filter, it placed the JSON syntax I needed in order to edit the query.  This has been very useful, thanks.

0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

Hi Michael,

what's happening for ago-assistant, The login button is always disabled. will ESRI continue the develop of this great tool?

Thanks.

0 Kudos
MikeMillerGIS
Esri Frequent Contributor

The log in is working for me.  I am not sure why it is not for you.  As for the support, I am not sure.

Here is the code if you are interested.

Esri/ago-assistant · GitHub

simoxu
by MVP Regular Contributor
MVP Regular Contributor

Thanks Michael.

I see some errors in my browser console, so I will report it as issues in Github.

Cheers

0 Kudos