Dynamic Date Value in Filter Widget using ArcGIS Online

4617
13
Jump to solution
11-29-2017 11:43 AM
Greg_Mattis
Occasional Contributor II

Hello,

We just updated our crime mapping application to be fed near real time and so now we are looking to have our update our Web App Builder to provide a better user experience.

We are wanting the field values in the filter widgets to be dynamic as the data changes so that it, on load shows the dates as being between the Current Date - 30 Days and the Current Date. I tried following the instructions that Jake Skinner‌ posted in his Document https://community.esri.com/docs/DOC-8191 and it worked for the Web Map but doesn't seem to work for the Value field of the filter in the attached image of the JSON code. We are only using ArcGIS Online and are looking to avoid putting the app hosted on our IIS because the whole reason we switched to ArcGIS Online was to take traffic away from our IIS.

Does anyone know if this is possible to do?

CC: MTwietmeyer-esristaff

Greg Mattis, GISP
GIS Analyst
City of Visalia
0 Kudos
13 Replies
MichaelVolz
Esteemed Contributor

Thanks for the additional information which is now working.

The link you provided for more info on 'what the heck is ::r: ?', pls read this help Define parameters in a query layer—Query layers | ArcGIS Desktop has information for Oracle that does not work.  I will work will ESRI technical support on this issue.

Can you create date ranges for 2 different fields in the same query like this:

SELECT * FROM earthquakes_7days_live where ::r:TimeRange OR SELECT * FROM earthquakes_7days_live ::r:TimeRange

where you have 2 different date fields that are populated.

I am using your syntax in place of mine as I have 2 date fields that are populated independently of each other which I would to perform a time query on both within the same query layer.

Trying to make this change is throwing additional errors and when one TimeRange parameter is changed it also changes the other TimeRange parameter.

0 Kudos
TanuHoque
Esri Regular Contributor

Thanks for letting me know.

As per Oracle help, it should work - I will look at this and update our help doc.

0 Kudos
TanuHoque
Esri Regular Contributor

Apparently I meant to send this, but never hit the Add Comment button. So sorry about that.


Updates:

As per Oracle help, it should work

I was wrong, Date() is not a SQL function. Thanks Michael Volz‌ for pointing that out. We will update the doc.

Can you create date ranges for 2 different fields in the same query like this:

 

SELECT * FROM earthquakes_7days_live where ::r:TimeRange OR SELECT * FROM earthquakes_7days_live ::r:TimeRange

where you have 2 different date fields that are populated.

 

I am using your syntax in place of mine as I have 2 date fields that are populated independently of each other which I would to perform a time query on both within the same query layer.

 

Trying to make this change is throwing additional errors and when one TimeRange parameter is changed it also changes the other TimeRange parameter.

While there, I also realized that I never answer this one Yes, you are right, 2 date fields are not currently supported.

Would you mind work with Esri support to submit an enhancement request?

Thanks a lot.
Tanu

0 Kudos
CurtNielsen
New Contributor III

We have a similar criteria if anyone is interested. We wanted the "Max" and "Min" sale date to be set automatically. So the Min would need to be 6 months minus the current date. The max would be today's date.We did this via a scheduled task on windows server to update the JSON file each night using a python script. I can post the code if anyone is interested.

Curt

0 Kudos