|
POST
|
Thanks. I downloaded and use webstorm. I followed instructions including uploading esrijs typescript library, but still didn't catch the case error of the script posted above.
... View more
07-01-2015
12:07 PM
|
0
|
0
|
628
|
|
POST
|
THANK YOU. I am so pissed at myself. This is why JS needs a good IDE to capture silly mistakes like this. Oh boy, do I miss my flash builder.....
... View more
07-01-2015
09:31 AM
|
0
|
2
|
628
|
|
POST
|
Here is: _County_selectedItem= "ALA"; _Route_selectedItem= 112; _PM1_selectedItem= 0.5; queryTask_odometerParams1.where= "County = '" + _County_selectedItem + "'" + " AND Route = " + _Route_selectedItem+ " AND PMc = '" + _PM1_selectedItem + "'" ; However, I think I am getting close. The root of the problem is the loop for (var attr in featureAttributes) If I remove the condition, for (var attr in featureAttributes) { //if (attr === "Odometer") //{ alert(attr + "1: " + featureAttributes[attr]); // } Then the alert shows only the first attribute which is not the Odometer. That explains, why I get no response. Why the loop does not iterate through the rest of the attributes and stops at the first one. The bizarre point is that in the good code, when I used attr = "Odometer", it displays the value just fine!!
... View more
07-01-2015
09:19 AM
|
0
|
4
|
1776
|
|
POST
|
Sure. Here is the "bad code". I already posted the good code in another response. I ensure you that the "where" and "url" lines are identical in both good and bad code since I copied and pasted. Thank you. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Shapes and Symbols</title> <link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css"> <style> #info { top: 20px; color: #444; height: auto; font-family: arial; right: 20px; margin: 5px; padding: 10px; position: absolute; width: 115px; z-index: 40; border: solid 2px #666; border-radius: 4px; background-color: #fff; } html, body, #mapDiv { padding:0; margin:0; height:100%; } button { display: block; } </style> <script src="http://js.arcgis.com/3.13/"></script> <script> var map; require([ "esri/map", "esri/layers/DynamicMapServiceLayer", "esri/tasks/QueryTask", "esri/tasks/query", "esri/symbols/SimpleMarkerSymbol", "esri/tasks/FeatureSet", "esri/InfoTemplate", "dojo/_base/Color", "dojo/dom", "dojo/on", "dojo/domReady!" ], function( Map, DynamicMapServiceLayer, QueryTask, Query, SimpleMarkerSymbol, FeatureSet, InfoTemplate, Color, dom, on ) { map = new Map("mapDiv", { basemap: "streets", center: [-25.312, 34.307], zoom: 3 }); map.on("load", readurl); function readurl() { var queryTask_odometer1 = new QueryTask("<place you url>); var queryTask_odometerParams1 = new Query(); queryTask_odometerParams1.geometry = false; queryTask_odometerParams1.outfields=["Odometer"]; queryTask_odometerParams1.where= <place your condition> ; //if (map.loaded) { queryTask_odometer1.execute(queryTask_odometerParams1,queryTask_odometer1_executeCompleteHandler,onError); //} else { // map.on("load", function () { // queryTask_odometer1.execute(queryTask_odometerParams1,queryTask_odometer1_executeCompleteHandler,onError); // }); } function onError(error) { console.log(error); } function queryTask_odometer1_executeCompleteHandler(results) { if (results.features && results.features.length > 0) { alert("something found: " + results.features.length); resultCount=results.features.length; for (var i = 0; i < resultCount; i++) { var featureAttributes = results.features.attributes; for (var attr in featureAttributes) { if (attr === "Odometer") { alert(attr + "1: " + featureAttributes[attr]); } } } }else{ alert("nothing found"); } //alert(mydata); } }); </script> </head> <body> <div id="mapDiv"></div> </body> </html>
... View more
07-01-2015
09:00 AM
|
0
|
6
|
1776
|
|
POST
|
Thanks. I agree, however the issue persists even after the correction. The strange thing is that the Good code even though has the same incorrect evaluation (attr = "Odometer"), it does work by providing a response with the correct value.
... View more
07-01-2015
08:18 AM
|
0
|
8
|
1776
|
|
POST
|
Actually, no. I get a response with the correct value. Thanks. Here is the complete good code, modified from one of the samples in the esri's JS API website. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Query State Info without Map</title> <script src="http://js.arcgis.com/3.13/"></script> <script> require([ "dojo/dom", "dojo/on", "esri/tasks/query", "esri/tasks/QueryTask", "dojo/domReady!" ], function (dom, on, Query, QueryTask) { var queryTask = new QueryTask("<place you url>); var query = new Query(); query.returnGeometry = false; query.outFields = ["Odometer"]; on(dom.byId("execute"), "click", execute); function execute () { query.where = <place your condition> ; queryTask.execute(query, showResults); } function showResults (results) { var resultItems = []; var resultCount = results.features.length; alert (resultCount); for (var i = 0; i < resultCount; i++) { var featureAttributes = results.features.attributes; for (var attr in featureAttributes) { if (attr = "Odometer") { alert(attr + "1: " + featureAttributes[attr]); resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>"); } resultItems.push("<br>"); } } // dom.byId("info").innerHTML = resultItems.join(""); } }); </script> </head> <body> US state name : <input type="text" id="stateName" value="474"> <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
07-01-2015
08:14 AM
|
0
|
0
|
1776
|
|
POST
|
This function returns undefined variable. The first alert returns: something found:1 the second alert returns "Odometer 1: undefined. I have a very similar code shown below under GOOD CODE that it returns the expected value. Both code execute the same querytask. What's wrong in the first block code? Thanks. function queryTask_odometer1_executeCompleteHandler(results) { if (results.features && results.features.length > 0) { alert("something found: " + results.features.length); resultCount=results.features.length; for (var i = 0; i < resultCount; i++) { var featureAttributes = results.features.attributes; for (var attr in featureAttributes) { if (attr = "Odometer") { alert(attr + "1: " + featureAttributes[attr]); } } } }else{ alert("nothing found"); } //alert(mydata); } GOOD CODE function showResults (results) { var resultItems = []; var resultCount = results.features.length; alert (resultCount); for (var i = 0; i < resultCount; i++) { var featureAttributes = results.features.attributes; for (var attr in featureAttributes) { if (attr = "Odometer") { alert(attr + "1: " + featureAttributes[attr]); resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>"); } } } // dom.byId("info").innerHTML = resultI
... View more
06-30-2015
04:42 PM
|
0
|
12
|
5214
|
|
POST
|
I tested that. Unfortunately, after I copied the app folder, the app is not showing in the WAB developer listing of apps. I also tried to zip it and import it, but it says invalid app.
... View more
06-23-2015
11:41 AM
|
0
|
0
|
1885
|
|
POST
|
When I was coding in Flex, I was able to package the libraries and code (export flash builder project) in a single file (fxp) at work and import in at home's flash builder to continue working on my projects. Is there are any similar process with WAB? Can I install WAB at two locations and copy the app folder from one location to paste it at another location to continue working on my project? Thank you.
... View more
06-11-2015
04:24 PM
|
0
|
7
|
5870
|
|
POST
|
ok, I solved the mystery. I finally got the LocalLayer in the configs folder. The instructions that comes with the LocalLayer widget says to add the reference to the widget in: "open the client\stemapp\themes\TabTheme\layouts\default\config.json in a text editor...." However, Rebecca's "Web AppBuilder Developer Edition–Customization Resource List" correctly points out to add the reference in default AND layout1 folders. That made the difference. I guess I learnt two lessons. Do not add customized widgets unless you add one ESRI's widget first to initiate creation of the configs folder. Second, Read Rebecca's list. THANK YOU Robert and Rebecca for your time.
... View more
06-03-2015
01:23 PM
|
1
|
1
|
452
|
|
POST
|
The problem is that there is no LocalLayer folder in the configs folder. This is the steps from the beginning. 1. Install the LocalLayer in the appbuilder 1.1 and performed the json modifications per instructions. 2. Created new app. The LocalLayer widget is visible in the widgets area. 3. Added bookmark widget and saved map. The configs folder is now visible. 4. Customized the LocalLayers to include a feature service. I don't know how to include the LocalLayer in the configs folder to apply Robert's code to implement definitionExpression. Ideas? Thank you.
... View more
06-03-2015
12:35 PM
|
0
|
3
|
1339
|
|
POST
|
Yes, is there now. I have bookmark widget under the new folder configs and one under the widgets folder. When I created the other app, I didn't add any widgets and I just installed the LocalLayer by following the instructions. In the LocalLayer instructions there is no mention of the configs folder. By not installing any of the ESRI's widgets, I guess the configs folder will not be created. I think the instructions for the LocalLayer should reflect the fact that if this is the first widget to be installed, that the configs folder will not be created. Please let me know if I am mis-reading the situation. Thank you.
... View more
06-03-2015
11:40 AM
|
1
|
5
|
1339
|
|
POST
|
No, everything is new. I just started the migration from flex and I am new on web appbuilder. So, I downloaded the 1.1 from the esri website and create the app. Everything went without a glitch until you made me aware of the missing folder. I am wondering how many other users are missing the folder and don't know about it. Is there another site (like github) that I can download the 1.1 and I will re-create the app to check if the config folder exist? Thank you.
... View more
06-03-2015
07:37 AM
|
0
|
7
|
1339
|
|
POST
|
ok, this is bizarre. I reinstalled the 1.1 version and still the configs folder is not there!!!!
... View more
06-02-2015
04:03 PM
|
0
|
9
|
1339
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Monday | |
| 1 | a week ago | |
| 1 | 10-22-2025 03:33 PM | |
| 1 | 06-27-2025 11:29 AM | |
| 1 | 06-16-2025 08:49 PM |
| Online Status |
Online
|
| Date Last Visited |
2 hours ago
|