Find features in different layers using SQL query

105
2
Jump to solution
05-07-2019 01:45 AM
Highlighted
New Contributor III

Hi guys,

Can someone point me how to make search in two different layers using SQL query? I use these code for one layers and want to use same search for different layers, does not mattter search fields have same names or not.

Thanks in advance

//saZiebo sistema
var HWUrl =
"http://localhost:6080/arcgis/rest/services/Melioracia_Geo_201801251705/MapServer/3";

var queryZebna = dom.byId("query-Zebna");

// magistraluri arxi
var HWLayer = new FeatureLayer({
url: HWUrl,
outFields: ["*"],
visible: false
});
// GraphicsLayer for displaying results
var resultsLayer = new GraphicsLayer({

title: "ძიების რეზულტატი"
});
//rukis Seqmna
var map = new Map({
basemap: "topo-vector",
layers: [resultsLayer]
})
var view = new MapView({
container: "viewDiv",
map: map,
extent: { // Extent Chemi rukistvis()
xmin: 5278000,
ymin: 5147000,
xmax: 4377000,
ymax: 5247784,
spatialReference: 102100
}
});

// Add a basemap toggle widget to toggle between basemaps
var toggle = new BasemapToggle({
titleVisible: true,
view: view,
nextBasemap: "satellite"
});

// Add widget to the top right corner of the view
view.ui.add(toggle, "top-left");

on(queryZebna, "click", function() {
queryMagistraluri()
.then(displayResults);
});

function queryMagistraluri() {
var query = HWLayer.createQuery();
//query.returnGeometry = true;
//query.outFields = ["*"];
let searchTerm = document.getElementById('searchInput').value;
query.where = "სარწყავი_სისტემა LIKE N'%"+ searchTerm +"%'";
query.outSpatialReference = view.spatialReference;
return HWLayer.queryFeatures(query)
}
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
MVP Esteemed Contributor

You can Not search two layers using a single query (SQL). You will have to do two separate queries.

View solution in original post

2 Replies
Highlighted
MVP Esteemed Contributor

You can Not search two layers using a single query (SQL). You will have to do two separate queries.

View solution in original post

Highlighted
New Contributor III

Thank you Robert

Reply
0 Kudos