|
POST
|
Robert, Thanks for helping me uderstand the search widget a little better. I am able to return the fields I need. I appreciate you getting me on the right track. I am currently hung up on how to get the Field Aliases and use those in the results from the search widget rather than the field names but my code is much cleaner now. If you can assist with the field alias I would appreciate it. I had used your earlier method, but it looks like what is returned in the search widget does not have the alias for the fields. <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="https://js.arcgis.com/3.18/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css">
<script src="https://js.arcgis.com/3.18/"></script>
<style>
}
</style>
<script>
require([
"dojo/dom", "dojo/on",
"esri/dijit/Search", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/domReady!"
], function (dom, on, Search, FeatureLayer, array) {
var lyrFields;
var URL = "https:myServer//rest/services/MyService/MapServer/25"
var search = new Search({
sources: [{
featureLayer: new FeatureLayer(URL),
searchFields: ["fulladdr"],
displayField: "fulladdr",
exactMatch: false,
outFields: ["fulladdr", "parcel_code", "lot_number", "subdiv_name"],
name: "Address",
maxResults: 1,
maxSuggestions: 20,
enableSuggestions: true,
minCharacters: 1
}],
allPlaceholder: "Find Address",
activeSourceIndex: "all"
}, "search");
search.startup();
var selectionMade = search.on("select-result", selectionHandler);
function selectionHandler(evt){
var resultItems = [];
{
var featureAttributes = evt.result.feature.attributes;
for (var attr in featureAttributes) {
resultItems.push("<b>" + featureAliases[attr] + ":</b> " + featureAttributes[attr] + "<br>");
}
}
dom.byId("info").innerHTML = resultItems.join("");
}
});
</script>
</head>
<p>Enter your address in the text box to get more details about your property for the form below:</p>
<div id="search" ></div>
<br />
<br />
<div id="info" style="margin: 5px; padding: 5px; background-color: #eeeeee;">
</div>
<br />
... View more
11-03-2016
11:49 AM
|
0
|
2
|
3551
|
|
POST
|
Robert, Thanks for your response. I may have not been using pagination correctly. I am looking for the Auto Complete function in the Search Widget. While I did get it to list the suggestions, for some reason I can't select a suggestion, and then use that in a QueryTask. I feel like I am close, but am missing something. I think it might be event when a suggestion is selected. <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Query State Info without Map</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.18/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css">
<script src="https://js.arcgis.com/3.18/"></script>
<style>
html,
body,
#search {
display: block;
cursor: pointer;
}
</style>
<script>
require([
"dojo/dom", "dojo/on",
"esri/tasks/query", "esri/tasks/QueryTask","esri/dijit/Search","esri/InfoTemplate", "esri/layers/FeatureLayer", "dojo/_base/array", "dojo/domReady!"
], function (dom, on, Query, QueryTask, Search, InfoTemplate, FeatureLayer,array) {
var lyrFields;
var URL = "https://MyServer/arcgis/rest/services/MyService/MapServer/25"
var queryTask = new QueryTask(URL);
var query = new Query();
query.returnGeometry = false;
query.outFields = [
"fulladdr", "parcel_code", "lot_number"
];
on(dom.byId("execute"), "click", execute);
var search = new Search({
sources: [{
featureLayer: new FeatureLayer(URL),
searchFields: ["fulladdr"],
displayField: "fulladdr",
exactMatch: false,
outFields: ["parcel_code", "fulladdr", "lot_number", "subdiv_name"],
name: "Address",
maxResults: 10,
maxSuggestions: 20,
//Create an InfoTemplate and include three fields
//infoTemplate: new InfoTemplate("Address", "Address: ${fulladdr}"),
enableSuggestions: true,
minCharacters: 0
}],
allPlaceholder: "Find Address",
activeSourceIndex: "all"
}, "search");
search.startup();
function execute () {
query.text = dom.byId("search").value;
queryTask.execute(query, showResults);
}
function showResults (results) {
var resultItems = [];
var resultCount = results.features.length;
lyrFields = results.fields
if (resultCount != 0) {
for (var i = 0; i < resultCount; i++) {
var featureAttributes = results.features[i].attributes;
for (var attr in featureAttributes) {
resultItems.push("<b>" + getFldAlias(attr) + ":</b> " + featureAttributes[attr] + "<br>");
}
resultItems.push("<br>");
}
dom.byId("info").innerHTML = resultItems.join("");
}
else
{
dom.byId("info").innerHTML = "Address Not Found";
}
}
function getFldAlias(fieldName){
var retVal = "";
array.some(lyrFields, function(item){
if(item.name === fieldName){
retVal = item.alias;
return true;
}
});
return retVal;
}
});
</script>
</head>
<p>Enter your address in the text box to get more details about your property for the form below:</p>
<div id="search" ></div>
<input id="execute" style="font-weight: bold;" type="button" value="Click here for details" />
<br />
<br />
<div id="info" style="margin: 5px; padding: 5px; background-color: #eeeeee;">
</div>
<br />
... View more
11-02-2016
03:12 PM
|
0
|
4
|
3551
|
|
POST
|
Robert, Thank you. This is perfect, I could not find any samples like this so I appreciate you posting this!
... View more
11-02-2016
10:29 AM
|
0
|
0
|
1558
|
|
POST
|
Thanks Robert for the sample. It helps, but what I was trying to do was get the AutoComplete in the Search widget to work without a map and pass the results of the search to a Query Task or use the Out fields from the Search widget. I would appreciate any assistance with this. Thanks <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Query State Info without Map</title>
<script src="https://js.arcgis.com/3.18/"></script>
<style>
html,
body,
#search {
display: block;
position: absolute;
z-index: 2;
top: 20px;
left: 74px;
}
</style>
<script>
require([
"dojo/dom", "dojo/on",
"esri/tasks/query", "esri/tasks/QueryTask", "esri/dijit/Search","esri/InfoTemplate", "esri/layers/FeatureLayer", "dojo/domReady!"
], function (dom, on, Query, QueryTask, Search, InfoTemplate, FeatureLayer) {
var queryTask = new QueryTask("URL to Feature Server");
var query = new Query();
query.returnGeometry = false;
query.outFields = [
"fulladdr", "parcel_code", "subdiv_name", "lot_number"
];
on(dom.byId("execute"), "click", execute);
var search = new Search({
sources: [{
featureLayer: new FeatureLayer("URL to Feature Server"),
searchFields: ["fulladdr"],
displayField: "fulladdr",
exactMatch: false,
outFields: ["parcel_code", "fulladdr"],
name: "Parcels",
maxResults: 10,
maxSuggestions: 20,
//Create an InfoTemplate and include three fields
//infoTemplate: new InfoTemplate("Parcels", "Address: ${fulladdr}"),
enableSuggestions: true,
minCharacters: 0
}],
allPlaceholder: "Find Address",
activeSourceIndex: "all"
}, "search");
function execute () {
query.text = dom.byId("search").value;
queryTask.execute(query, showResults);
}
function showResults (results) {
var resultItems = [];
var resultCount = results.features.length;
for (var i = 0; i < resultCount; i++) {
var featureAttributes = results.features[i].attributes;
for (var attr in featureAttributes) {
resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>");
}
resultItems.push("<br>");
}
dom.byId("info").innerHTML = resultItems.join("");
}
});
</script>
</head>
<body>
<div id="search" ></div>
<input id="execute" type="button" value="Get Details">
<br />
<br />
<div id="info" style="padding:5px; margin:5px; background-color:#eee;">
</div>
</body>
</html>
... View more
11-01-2016
04:53 PM
|
0
|
6
|
3551
|
|
POST
|
I am using the QueryTask and would like to use the Alias in the results rather than the field names. The documentation sounds like I can do this https://developers.arcgis.com/javascript/3/jshelp/intro_querytask.html You must use the actual field names rather than the alias names, but you can use the alias names later when you display the results. but I could not find an example for doing this programmatically. Can someone provide an example of using the Alias Names rather than the Field names in the results from the Query Task? Thanks, Mele
... View more
11-01-2016
04:32 PM
|
0
|
2
|
2598
|
|
POST
|
I have created a simple query task using this sample: https://developers.arcgis.com/javascript/3/jssamples/query_nomap.html I would like to be able to use the Pagination in our ArcGIS Server 10.3.1 Map services. I have been able to use pagination with the Search Widget in a map, but would like to use the same type of auto complete without a map and return certain fields. I have been trying to combine the search widget and a query task without much success. Does anyone have a sample of doing this? Thanks, Mele
... View more
10-27-2016
11:04 AM
|
0
|
8
|
5111
|
|
POST
|
I am currently using the Editor Widget and the Attribute Inspector to allow users to add new features and then update the attributes with the Attribute Inspector. We have a request to expand the functionality so that users can edit and add features to a related table. In our use case, we have Sign posts as a point layer and we would like to add the signs associated to the Sign Post to a related table. Is this possible to edit the related records using Attribute Inspector, including adding new records to the table? Does anyone have some examples of doing this? Thanks, Mele
... View more
09-09-2016
04:30 PM
|
0
|
0
|
1667
|
|
IDEA
|
I had submitted the issue with Feature Service field order as a Bug if anyone wants to add their name to this to raiser the severity. #BUG-000090535 [Enhancement] Feature Service Fields List Order is not maintained on REST As far as the Feature Class field order, sometimes we may add a field that is related to other fields and it would be nice if it were in logical order in the GDB schema rather than having to move it around in the MXD. For instance, if we add a "Unit_Number" field it would be nice to put it after the other address fields in the database. Mele
... View more
07-08-2016
09:31 AM
|
0
|
0
|
2425
|
|
POST
|
Is it possible to open the legend by default when someone opens an ArcGISOnline Web Mapping Application? I am using the Basic Viewer but did not see how I could open this by default. Thanks, Mele
... View more
07-04-2016
01:30 PM
|
0
|
2
|
2851
|
|
POST
|
I would like to be able to send the coordinates from a feature to Google for Directions/Street View - Can this be done via the Popup configuration? I know how to hyperlink with the popup, but don't know how to get the coordinates. If so, can someone share an example? Thanks Mele
... View more
07-04-2016
01:28 PM
|
0
|
1
|
2304
|
|
POST
|
Thanks for the samples! This looks like I was looking for. I like that it is in C# too. I will work with it this week.
... View more
05-30-2016
08:40 AM
|
0
|
0
|
9965
|
|
POST
|
Adrian, Thanks for the reply. I am looking for the data source of our organization's map services that are hosted on our internal ArcGIS Server not those on AGOL. Mele
... View more
05-25-2016
08:31 AM
|
0
|
0
|
9965
|
|
POST
|
I am looking for some programmatic way to get the underlying data source used for a Map Service Layer. We use mostly SDE layers, so I would like the Feature Class Name. I was able to do this with ArcObjects with C# .NET prior to 10.1 but I don't believe it can be done the same way due to the changes in ArcGIS Server architecture Does anyone have any code examples of getting the layer sources? I may end up using the MXD to compile data sources, but would like to go against the map services directly if possible. Thanks, Mele
... View more
05-24-2016
03:47 PM
|
0
|
16
|
20360
|
|
POST
|
We are upgrading our ArcGIS server 10.2.2 to 10.3.1. We have two SOEs that are needed once we upgrade. I am trying to ensure that there will be no issues when I upgrade. According to ESRI I only need to remove the SOEs prior to the upgrade and then add them back after the upgrade. My question is do I need to upgrade the ArcObjects SDK prior to upgrading the ArcGIS Server installation and adding the SOEs back? The SOE uses the SOESupport assembly which I believe comes from the SDK and that is why I was wondering if the SDK needed to be upgraded. I am assuming that because my SOE is currently working in 10.2.2 that .NET 3.5 SP1 is installed, correct? Thanks for any input. Mele
... View more
04-10-2016
10:16 AM
|
0
|
1
|
5320
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-27-2026 09:23 AM | |
| 1 | 02-26-2026 06:47 AM | |
| 3 | 10-20-2025 05:21 AM | |
| 1 | 03-13-2015 04:39 PM | |
| 1 | 09-18-2025 08:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|