Select to view content in your preferred language

Edit MapManager to query FeatureAcces Service with URL Parameter

959
5
Jump to solution
05-30-2018 07:25 AM
Juan_ManuelAngel_Cuartas
Emerging Contributor

Hi Friends, if some one can help me or give any idea how i can query the Feature Access Service in a WebApp Builder if i pass the parameter in the url with the OnLoad Event, i have this code idea:

url = http://localhost/webApp/Index.html?CountryCode = 1

I get the code with javaScript Code and then i pass to QueryTask in JavaScript in the MapManager

mapMain.graphics.clear();
var x = "URL PARAMETER GET"
//alert(x);
var query2 = new Query();
query2.outFields = ["CODIGO_CATASTRAL,MUNICIPIO"];
query2.returnGeometry = true;
query2.where = "COUNTRY_CODE= '"+x+"'";
queryTask2.execute(query2, CreateGraphics);
.

.

.

If some one Have any idea of how to do that its be very helpfull thanks !

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Juan,

   In the MapManger.js file you have access to this.urlParams that will give your the url parameters.

View solution in original post

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

Juan,

   In the MapManger.js file you have access to this.urlParams that will give your the url parameters.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Juan,

   Did you try my suggestion?

0 Kudos
Juan_ManuelAngel_Cuartas
Emerging Contributor

Hi Robert Thank you, i forget answer and mark as correct , yes its work perfect, when i call the parameter but i have another problem, I need to set that param value to make a DefinitionQuery to a layer that was add in the webMap, the problem is when i use the getLayersId i just get the basemap id but not the other layer to setDefinitionQuery, do you have any idea ?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Juan,

   If the layer if a FeatureLayer then you have to use the maps graphicsLayerIds property instead of the layerIds property.

0 Kudos
Juan_ManuelAngel_Cuartas
Emerging Contributor

Robert Thank you so much, i can query with the GraphicLayerIds and works perfect !

0 Kudos