Hello,
We are customizing the AppStudio Offline Geocoding and Routing app with our own data. We would like to add the option of selecting the POIs from a combo box so people can select a POI by name if they don't know its location.
The app is build on a mmpk file which includes a locator and a POI layer. The POI layer is the same used to build the locator. We have tried this, but it seems that it doesn't go through the if so the const result in the loop is not defined. How can I fix the problems?
MobileMapPackage {
id: mmpk
path: AppFramework.resolvedPathUrl(copyLocalData(inputdata, outputdata))
// load the mobile map package
Component.onCompleted: {
mmpk.load();
}
// wait for the mobile map package to load
onLoadStatusChanged: {
if (loadStatus === Enums.LoadStatusLoaded) {
// set the map view's map to the first map in the mobile map package
mapView.map = mmpk.maps[0];
// get POITest feature layer and feature table
const poiLyr = mapView.map.operationalLayers.get(3);
const poiTable = poiLyr.featureTable
// create query parameters object
let parameters = ArcGISRuntimeEnvironment.createObject("QueryParameters");
parameters.whereClause = "1-1";
// query table with parameters
let query = poiTable.queryFeatures(parameters);
// get results
if (query.queryFeaturesStatus === Enums.TaskStatusCompleted){;
console.log("going through if");
const result = queryFeaturesResults[query];
}
// iterate on results and fill combo box
const poiList = [];
while (result.iterator.hasNext()) {
var feature = iterator.next();
poiList.push(feature.attributes.attributeValue("Titre"));
}
comboBoxDestination.model = poiList.sort();
}
}
}
Thanks!