POST
|
The only way I've found around the async issue is to undertake only synchronous actions in the event handler. I built a small service in C# that I can call synchronously that gets the necessary info. If there is a way to synchronously call a javascript function and have that function make async calls, but not return a value until the async calls return a value, I would love to know how.
... View more
04-12-2017
10:43 AM
|
0
|
0
|
1042
|
POST
|
The sample code I marked as a solution works great if the code necessary to determine the values is all synchronous. If appears that the before apply edits method is called synchronously and does not respond to deferred functions. I'm trying to find a way around it. If the esri code that called this method used the dojo when method all would be well...
... View more
04-11-2017
12:46 PM
|
0
|
1
|
1042
|
POST
|
I know this answer is a good bit after the question was asked, but it might help someone else. Scenario: Attempting to add a new record to a geometry table via the arcgis rest service associated with it. We get a duplicate primary key id. The admin log for the arcgis website says the objectid value it's trying to use. We look in the table and there is not only a record in the table with that id, there are more records with objectid values higher than that record. As far as I can tell, the sde database schema was designed back when DBase II was the bee's knees and it was ported as was to sql server. So, instead of using the built-in increment id feature available in sql server, the existing code was used. There is a next id table per geometry table and that table was out of whack. The sql server database has a stored procedure that you can execute if you're in that situation. It will increment the next objectid value in that next id table by 1. Obviously, if the next id is 100 less than the highest objectid in the table, you'll need to do so 100 times. (Or open up the stored procedure, figure out what it does, and hack the next id table directly, but that's almost certainly an unsupported behavior.) Here's a script to invoke it: USE [YourDatabaseName] GO DECLARE @return_value int, @rowid int EXEC @return_value = [dbo].[next_rowid] @owner = N'YourSchemaName', @table = N'YourTableName', @rowid = @rowid OUTPUT SELECT @rowid AS N'@rowid' SELECT 'Return Value' = @return_value That doesn't solve the problem of HOW the next objectid value got out of synch with the data in the table. There appear to be a host of ways to make that happen.
... View more
04-11-2017
07:29 AM
|
0
|
0
|
655
|
POST
|
I'm pretty close to a solution that will work for me. I have to integrate in a call to a web service (preferably asynch) before I'm done. But assuming you can compute the values you need without doing all that, here's what will work. The solution was complicated by an unexpected "feature" of the product. When I am using the edit widget and click on the map, a point is actually created in the database and ONLY THEN is the user asked for input on the attribute values. I had assumed that an object was created in memory, displayed on the map, the user was asked for input on the attribute values, and ONLY THEN was the database record inserted. That's not as nice an arrangement when it comes to improving data quality as what I expected, but such is life. Once that misconception was corrected, I needed to find a way to intercept between the request to insert the records and the actual insert. It turns out that the javascript api FeatureLayer class has an event that I can attach a custom function to. I can change the attribute values in that custom function at runtime and the changed values will be written to the database before the user is given a say on attribute values. And, of course, I had to find the correct place to update that feature layer's event handler. The good and bad portion of this approach is that any object that gets the featureLayer in question from the map object should have this set of rules applied once the edit widget has been opened. In theory, that would apply to other widgets that change the data, but I haven't proven that (yet). I recommend cloning the edit widget set of files and making your own custom edit widget, just in case you ever need to fall back to plain vanilla edits. Here goes: (in the edit widget 'widget.js' file) // The widgets.js file is one long list of variables and function definitions. I popped in this code after the // comment "Methods for prepare to create Editor" as a convenient place to put it. onBeforeApplyEditsForMyFeatureLayer: function (toDoList) { var iMax = 0; if (toDoList) { if (toDoList.adds && toDoList.adds.length > 0) { iMax = toDoList.adds.length; for (var i = 0; i < iMax; i++) { // Use the attribute names, algorithms, and values that meet your needs. toDoList.adds.attributes.MyAttributeName = 'my custom run-time defined value'; } // Repeat above code for toDoList.updates and toDoList.deletes as desired. } } }, Then I modified the _getLayerInfosParam function in the same file. _getLayerInfosParam: function() { // ... some code at the start of the function that you leave alone until you get to here... array.forEach(layerInfos, function (layerInfo) { var layerObject = this.map.getLayer(layerInfo.featureLayer.id); // insert this if statement here using the appropriate id for the feature... if (layerObject && layerInfo.featureLayer.id === 'MyFeatureId') { on(layerObject, 'before-apply-edits', lang.hitch(this, this.onBeforeApplyEditsForMyFeature)); } // ... some more code after the change you must made, that you also leave alone. // Existing closing braces are shown below for clarity } // ... more code after the change that you leave alone. }, Hope this helps someone else.
... View more
04-10-2017
11:33 AM
|
1
|
0
|
1042
|
POST
|
Yes, we are using templates and are setting some default values that way. However, they are static default values, i.e., always put an "X" in field_x. In this case, I need to put in values that are calculated at runtime depending upon the location of the point. If that's possible to do with templates, I missed that in the documentation. Is it?
... View more
04-10-2017
05:07 AM
|
0
|
0
|
1042
|
POST
|
I've been doing some more research into the edit widget code. It appears that the actual creation of the point isn't an edit widget task, that appears to be an event tied to the map. (The previous statement is not to be considered "a statement of fact", it's my best current working guesstimate...) If anyone knows the name of the javascript file and the name of the routine where a map-click gets turned into a point in the database, feel free to chime in. I'll keep digging.
... View more
04-07-2017
12:32 PM
|
0
|
2
|
1042
|
POST
|
I know how to set default values in an ArcGIS service at design time. However, I need to intervene in the creation of a geometric item at run time to dynamically decide what the default values should be. For example: User picks a template for a point-based service and clicks on the map to create the point. The widget decides where that point is and determines the latitude/longitude of the point. The widget decides what the default attribute values should be for the new point based upon the service definition. ***At this point, I want to intercept the creation of the point and alter some of the default values *** The widget displays the attribute values in an editor and the point on the map for the user to edit. Ideally, I would like to intercept in such a way that if a different widget somehow created a point, the same intercept code would be invoked and the appropriate default values would be assigned at run time thru an event handler. Failing the ability to hook into an event at the correct point in time, what routine would folks recommend implementing the code hook from?
... View more
04-06-2017
01:07 PM
|
0
|
7
|
2349
|
POST
|
I no longer recommend setting cacheBust = true. The v2.3 product has a serious bug that will cause widgets and icons not to display. (Of course, a future version might fix the problem.) javascript - CacheBust in dojoConfig breaks paths - Stack Overflow
... View more
04-04-2017
07:55 AM
|
1
|
0
|
798
|
POST
|
javascript - CacheBust in dojoConfig breaks paths - Stack Overflow I changed the CacheBust setting to false and the problem went away.
... View more
04-04-2017
07:07 AM
|
1
|
0
|
1641
|
POST
|
javascript - CacheBust in dojoConfig breaks paths - Stack Overflow I changed the CacheBust setting to false and the problem went away.
... View more
04-04-2017
06:41 AM
|
1
|
0
|
1159
|
POST
|
After some more digging, I've opened up another thread as the problem may pre-date trying to deploy it: Web AppBuilder "application" won't Launch in Web AppBuilder Tool
... View more
04-03-2017
05:25 AM
|
0
|
0
|
1641
|
POST
|
We installed Web AppBuilder and hooked it up to our local Portal installation and built a test app. We used these two documents to do so: https://developers.arcgis.com/web-appbuilder/guide/getstarted.htm https://developers.arcgis.com/web-appbuilder/guide/build-your-first-app.htm If I edit the test app the widgets I assigned to be in the test app show up. If I Launch the test app from within Web AppBuilder, the widgets also show up. When I use the browser debugging tools to track what calls are being made over the network, I see calls like this for widgets: myserverUrl/widgets/Search/manifest.json?wab_dv=2.3 I then created several other web apps. They work just fine in web app builder "edit" mode. However, if I attempt to launch them within web appbuilder, none of the widgets show up. When I use the browser debugging tools to track what calls are being made over the network, I see calls like this for widgets: myserverUrl/widgets/Search/?1234567890123manifest.json&wab_dv=2.3 Obviously, it doesn't find the widget manifest file as the url call is malformed. I don't know what I've forgotten to do or done wrong. I've been trying to debug a deployment issue but as I back-tracked thru things, I realized the problem might predate any deployment issues. Unless, of course, one has to have deployed an app before one can launch it in the web appbuilder tool.
... View more
03-31-2017
12:00 PM
|
0
|
1
|
3321
|
POST
|
Changing permissions, etc, did not get rid of the 403 error. I enabled directory browsing and the 403 error went away for calls like this: myserverUrl/widgets/Search/?1234567890123manifest.json&wab_dv=2.3 Of course, that doesn't help because the above call didn't return the widget, it returned an html doc listing the files in the directory... I've been running my application in WAB in edit mode on my development machine. It works perfectly. I realized I had never launched the application from WAB on my development machine, so I tried that. It has the same problem - the widgets don't show up, and for the same reason. (It's just that no IIS was involved to forbid directory browsing...) However, an earlier, simpler map does launch correctly with the widgets showing. I'm going to rebuild my application from scratch, and transfer in each custom widget one at a time until I figure out what's going on. Any suggestions would be very welcome!
... View more
03-29-2017
05:25 AM
|
0
|
1
|
1641
|
POST
|
Additional info that might be relevant: 1) Stand-alone portal installation, not hooked to internet (and thus not hooked to ArcGIS.com or arcgisonline.com 2) Portal uses active directory single sign-on to connect to the portal. 3) sample call that fails with a 403: myserverUrl/widgets/Search/?1234567890123manifest.json&wab_dv=2.3 I have a manifest.json file in the that directory, but not a 1234567890123manifest.json. 4) I've just noticed that a lot of entries in the config.json file have references to webappbuilder\app#\ directories. I tried removing that portion of the directory path but no change in behavior was observed.
... View more
03-28-2017
11:25 AM
|
0
|
0
|
1641
|
POST
|
I've installed Web AppBuilder and created an application using standard and custom widgets. It runs just fine from Web AppBuilder Developer. When I deploy the application to the web server on a different computer, the application displays the map and the data on the map, but NONE of the widgets show up. Does not matter whether they are built-in widgets or custom widgets. All the https calls for the widgets return a 403 forbidden error. Any idea?
... View more
03-28-2017
11:12 AM
|
1
|
6
|
3332
|
Title | Kudos | Posted |
---|---|---|
1 | 03-03-2017 10:52 AM | |
1 | 04-04-2017 07:55 AM | |
1 | 04-04-2017 06:41 AM | |
1 | 04-24-2017 04:55 AM | |
1 | 06-28-2017 06:35 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|