Hello @MikeWilburn ,I'm trying to just query a feature where I get its result
back but have no way/idea on how to get the result back once it finishes. I found this link
https://community.esri.com/t5/arcgis-%E9%96%8B%E7%99%BA%E8%80%85%E3%82%B3%E3%83%9F%E3%83%A5%E3%83%8B...
but as shown in the screenshot the
Unresolved reference: queryFeaturesAsync
this is the relevant code
var searchForPolygon: (String) -> Unit = { searchString ->
var query = QueryParameters()
query.whereClause = createstr(searchString)
Log.d(TAG, query.whereClause.toString())
// Perform the query on the hosted polygon data
val future = serviceFeatureTable!!.queryFeaturesAsync(query)
// Use the SAM conversion to handle the query result
future.addDoneListener {
try {
// Get the entire result of the query
val result = future.get()
// Check the result
if (result.iterator().hasNext()) {
// Get the first result and zoom to the corresponding feature
val feature = result.iterator().next()
val envelope = feature.geometry.extent
} else {
Toast.makeText(this@MainActivity, "No polygon found for this search: " + searchString, Toast.LENGTH_SHORT).show()
}
} catch (e: Exception) {
Toast.makeText(this@MainActivity, "Failed to search for features: " + searchString + ". Error=" + e.message, Toast.LENGTH_SHORT).show()
Log.e(TAG, "Feature search failed for: " + searchString + ". Error=" + e.message)
}
}
}
fun createstr (searchString: String) : String {
var reString: String? = null
val ku = searchString.split("区".toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()
if (ku.size > 1) {
reString = "upper(CSS_NAME) LIKE '" + ku[0] + "区' and (MOJI) LIKE '%" + ku[1] + "%'"
} else {
reString = "upper(MOJI) LIKE '%" + ku[0] + "%'"
}
Log.d(TAG, "SQL String="+ reString)
return reString
}
the documentation is quite lacking as there is no code on how use the functions.
Thank you