Hi,
We have an app that was created with webappbuilder 2.2 that only hold one layer.
This layer has 14 polygones and we want to send papramter to the map so it will open with the realvant polygone
instead of creating 14 diffrent apps / maps.
For example -
http://gisserver/portal/apps/webappviewer/index.html?id=92fa9ecbb5cc433daa7ce8c9fe18cf45&FILTER=MYLA..., Code=1-14 ( 1,2,3...14 )
The same as here Use URL parameters to modify maps—ArcGIS Online Help | ArcGIS but filter the data.
Hope i make myself clear..
Avishai
I marked you other post as a dupe so this should be you primary.
tagging https://community.esri.com/community/gis/web-gis/web-appbuilder?sr=search&searchId=e94524a8-dd10-4ac... and https://community.esri.com/community/gis/web-gis?sr=search&searchId=35182f98-1037-42cf-9e05-27330fb2... for more exposure.
Avishai,
So you are saying that you are having a hard time figuring out how to use the Query or find parameters?
The "Query a feature" only zooms in and select the feature and does not filter the data ( removes all other features )
You can se from the help Doc I linked to there is no filter parameter. Only query and find.
Right - my question is if if it possible to do? and how ?
Which code base would that be ? the map ? app ? and where can we find the file storing the code ? ( path / directory in the server )
We found out that the layerDefinition function does the filtering needed at the arcgisportal\content\items\query_.. file but how can we make it into a parmeter ?
Thanks !
You would have to get WAB developer edition to be able to work with the WAB code base and then you would have to host your customized WAB app on your own server as customized WAB apps can not be hosted on AGOL.
Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers
The url parameters are handled in the [install dir]\server\apps\[app#]\jimu.jsMapUrlParamsHandler.js
I guess my question is now how do I insert the 'layerDefinition' in order to filter the Feature instead of just selecting it ?
selectFeatures(map, layer2, queryArray); & FilterFeatures(map, layer2, queryArray);
( or is there some other way doing so ? )
Thanks !
This is the "query" function syntax -
function queryFeature(queryObject, map){
/************************
?query=<layerName/layerId, fieldName, fieldValue>
?query=<layerName/layerId, whereClause>
*************************/
//?query=Cities,pop>1000&level=10
//?query=Cities,city_name,Rome&level=10
var queryArray = queryObject.query.split(";");
if (queryArray.length === 1) {
queryArray = queryObject.query.split(",");
}
if(queryArray.length !== 2 && queryArray.length !== 3){
console.error('query URL parameter is not correct.');
return;
}
var layerNameOrId = queryArray[0];
//by name first
getLayerByNameOrId('name', layerNameOrId, map).then(function(layer){
if(layer === null){
getLayerByNameOrId('id', layerNameOrId, map).then(function(layer2){
if(layer2 === null){
console.error('Invalid layer name or id.');
}else{
selectFeatures(map, layer2, queryArray);
}
});
}else{
selectFeatures(map, layer, queryArray);
}
});
}