Has anyone been able to use URL Parameter to query a feature in WAB?

2840
9
02-25-2016 12:02 PM
DanielWilson
New Contributor III

Has anyone been able to use URL Parameter to query a feature in WAB?  I’m trying to follow the documentation located here https://doc.arcgis.com/en/web-appbuilder/manage-apps/app-url-parameters.htm under the Query Feature sections. ESRI support logged BUG-000094358 because they were not able to successfully query a feature in WAB either.  I don’t understand why documentation would be created for something that’s not possible.  I would think it would be tested before it was published.

0 Kudos
9 Replies
BrianO_keefe
Regular Contributor II

I did it.

Unfortunately for this situation, it's in an internal map. So I can't share. I'll try to put together a walkthrough soon. The key is 'feature service' and in the Product page for your AGOL map based off of the feature service you create your connections there.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Daniel,

   Sure here is a thread where I address this same question. Has anyone used the 'query' URL parameter? (WAB DE 1.3)

0 Kudos
deleted-user-dbQhBq-o3nyM
Occasional Contributor

We had it working for a while (couple of months) in our WAB, but then it broke just the other day. The documentation that was provided by ESRI was not exactly correct. ESRI Tech support had some kind of fix for us, but like I said, it broke on me two days ago.

0 Kudos
LefterisKoumis
Regular Contributor

Alternatively, you can just read the url parameter and assign it to a variable to be used in a query widget. I have been using this workflow and it works great.

0 Kudos
AlistairFox
Occasional Contributor

Are you referring to configuration or customization using the dev edition for the solution you mention here??

0 Kudos
LefterisKoumis
Regular Contributor

No. I am referring to a real time.

For example you have a url like this

http://(server)/myapp/index.html?config=my_config.json?county=SLO&route=1

Then have widget that starts up when your app opens and in that widget under the startup function read the url parameter

and perform any actions you want similar to this:

urlSubstring = location.search.substring(1);
//console.log(urlSubstring);
if(urlSubstring.indexOf("?")>0){
var myparams1 = urlSubstring.split('?');
urlSubstring = myparams1[1];
}
------

-------

0 Kudos
MichaelRobb
Regular Contributor II

Makes sense, 

so you require the query widget to exist in the web app (or a custom widget)?

I guess my other question would be is, why? Is there a particular scenario where URL Query(as intended) does not work?  We use URL Query and have no issues so I am a bit confused why one would go through this trouble.

0 Kudos
LefterisKoumis
Regular Contributor

I wrote this script some time ago when there was no url query widget. However, this approach is very useful dynamic apps. So, when you have the user to make choices by selecting variables in drop down boxes or typing something in a textbox. Then, you grab those variables and on the fly you create a url where you append these selected variable and you call the url using a custom config file. Bear in mind that based on the selections you can also in script can specify with config.json file to use. All that can happen behind the scenes after the user make their selections on a webpage and produce a  customized map.

0 Kudos
MichaelRobb
Regular Contributor II

Trying to understand what is meant here.  Though I have never had an issue with the URL Query with 2.1 (we did with 1.3 not showing attributes from a layer that is part of a group layer).

Are you saying you have written javascript to handle taking the URL and magically applying this to the query widget (Which would have to be in the web app)?

Sounds like a lot of unnecessary custom coding if that is the case.

Perhaps you mean that you, as a user, simply look at the URL and hope that the layer, field and field value has been configured in the query (ability to add those) widget for you to manually do.

I would not consider this user friendly at all, and worse yet, would have to force business rules to a 'must have query widget' and must have xxx conditions.

But perhaps you mean something else... 

If you can elaborate that would be great!

0 Kudos