|
POST
|
First off when the below is run it properly sends the parameter to the GP Service and the python script behind the scenes functions properly... BUT I am not getting anything back or anything written to the console. I do not even get the alert to fire in the .execute function. No errors in the console....Im puzzled. I am definitely Synchronous I have a .net c# webpage that I am clicking a button as you can see below. Using a window.JSControlller to get to my JS Function..... BUT I am now getting an error relating to the LANG which I think I have referenced correctly in the JS File... .ASPX PAGE <asp:Button ID="btnGISPush" runat="server" OnClientClick="window.JsController.btnGISPush_Click()" Text="GIS Push" CausesValidation="true" /><br />
ENTIRE JS PAGE I added the requires for dojo lang....but nothing happening and no alerts from withing the function and not err going to console...hmmmmm require(["dojo/_base/lang"], function(lang){ // lang now contains the module features}); require([
"esri/tasks/Geoprocessor", "dojo/_base/lang"
], function (Geoprocessor, lang) {
"use strict";
var gpUrlJSON ="https://xxxx.gov/arcgis/rest/services/Test/createJSON/GPServer/createJSON";
var gpJSON = new Geoprocessor(gpUrlJSON);
window.JsController = {
btnGISPush_Click: function () {
// Capture String value to populate params
var HistoricUser = document.getElementById(JSONstring).value;
alert("Parameter being passed: " + HistoricUser);
var params = {
request: HistoricUser
};
gpJSON.execute(params, lang.hitch(this, function (jobInfo) {
//job submit success case
var jobid = jobInfo.jobId;
alert("jobId stringify: " + JSON.stringify(jobid));
console.log("jobId: " + jobid);
}),
function (err) {
//this is in error case
console.log("I got error with job execution")
console.log(err);
}
);
} // END OF BUTTON CLICK FUNCTION
}; // END OF JS CONTROLLER
}); // END OF REQUIRE
... View more
04-04-2020
09:46 AM
|
0
|
0
|
3243
|
|
POST
|
it still passes the parameter and the python script works...but it does not return anything....as I mentioned if I try and alert the jobid i get "undefined" its in a huge app right now...trying to think of way to shrink ot down....will try and post something a bit later...
... View more
04-03-2020
01:09 PM
|
0
|
0
|
3243
|
|
POST
|
In my code above it I alert the Jobid I get UNDEFINED var jobid = jobInfo.jobId;
alert(jobid);
... View more
04-03-2020
12:39 PM
|
0
|
7
|
3243
|
|
POST
|
This works: gpJSON.execute(params); This does not: gpJSON.execute(params).then(function (jobInfo) { // snip var gpUrlJSON ="https://xxxx.gov/arcgis/rest/services/DGIF_Test/createJSON/GPServer/createJSON";
var gpJSON = new Geoprocessor(gpUrlJSON); my return parameter is called "result"...I changed my code to this but still nothing I dont even get into the function to return a simple alert as seen below....so something is going wrong gpJSON.getResultData(jobId, result, requestOptions).then(function () {
alert("jobId");
});
... View more
04-03-2020
12:19 PM
|
0
|
2
|
3243
|
|
POST
|
I cant seem to get the results of my GP call....is Synchronous call so .execute would be used. What am I missing here? I think I have to use the getResultData because of the Synchronous service additionally I have an output parameter on the service...I would like to learn how to caputure this value as well Noting that this works fine: gpJSON.execute(params); var HistoricUser = document.getElementById(JSONstring).value;
var params = {
request: HistoricUser
};
gpJSON.execute(params).then(function (jobInfo) {
var jobid = jobInfo.jobId;
var requestOptions = {
interval: 500,
statusCallback: function (j) {
console.log("Job Status: ", j.jobStatus);
}
};
gpJSON.getResultData(jobId, resultName, requestOptions).then(function () {
alert("job completed");
});
});
... View more
04-03-2020
11:34 AM
|
0
|
14
|
4801
|
|
POST
|
solved I was not setting up the params variable properly nor was I handling the parameter in Python properly... This works for me....any questions hit me up var dictstring = '{"employees": [{ "address": "1520 Split Oak Ln, Henrico, Virginia, 23229", "distance": "10", "id": "1" }, { "address": "113 Buffalo Rd, Clarksville, Virginia(VA), 23927", "distance": "50", "id": "4" }, { "address": "8817 Sherando Dr, Bristow, Virginia(VA), 20136", "distance": "20", "id": "5" }]}';
var params = {
request: dictstring
};
gpJSON.execute(params); import arcpy
import requests
import json
dataInputParameter1 = arcpy.GetParameterAsText(0)
textDict = json.loads(dataInputParameter1)
for employee in textDict['employees']:
varsearchAddress = employee["address"]
varsearchDistance = employee["distance"]
varsearchid = employee["id"]
print ("address: " + varsearchAddress)
print ("distance: " + varsearchDistance)
print ("uniqueid: " + varsearchid)
... View more
04-03-2020
11:19 AM
|
0
|
0
|
2594
|
|
POST
|
I did it this way....but trying to figure out if I can do this easier..... Is there an easier or shorter way to grab a textbox value and WRITE back to another textbox? I am reading it now but would liketo write back results to another textbox on the aspx page I made the textbox and button in .aspx page I added the RegisterStartupScript line to the Page_Load Made the window.JsController wrap with my function... .ASPX page <asp:TextBox ID="txtAddressCall" Width="800px" Height="60px" MaxLength="300" runat="server" TextMode="MultiLine" Wrap="true" Enabled="false" Visible="false"></asp:TextBox><br />
<asp:Button ID="btnGISPush" runat="server" OnClientClick="window.JsController.btnGISPush_Click()" Text="GIS Push" CausesValidation="true" /><br />
ASPX.CS Page protected void Page_Load(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "JsVariables", "var txtboxClientId='" + txtAddressCall.ClientID + "';", true);
SNIP
JS Page window.JsController = {
btnGISPush_Click: function () {
var name = document.getElementById(txtboxClientId).value;
alert(name);
}
};// js object block end
... View more
04-03-2020
08:32 AM
|
0
|
2
|
3608
|
|
POST
|
Last question....can I still get a value of a text box like this and set it to a variable? const distanceUnit = document.getElementById("distance-select"); if not how do I get the value of an element
... View more
04-03-2020
06:11 AM
|
0
|
3
|
3608
|
|
POST
|
any have any thoughts....I simply want to register a JS page in .net and then have an asp button that calls the JS page and have the JS page run some code.
... View more
04-02-2020
10:28 AM
|
0
|
0
|
3608
|
|
POST
|
I can get this to work from within the asp page with a couple script tags at the top but I want to call the JavaScript page because I have most of my code there. <!-- IN THE ASP PAGE -->
<script>
function btnGISPush_Click() {
alert("somrtindfgdfg");
}
</script>
... View more
04-02-2020
07:19 AM
|
0
|
2
|
3608
|
|
POST
|
Having issues here.....I have a webform .net C# application that I am trying to inject some code.... I just want to show that this works...I am simply trying to click an asp button and call a function in JavaScript Please help <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Edit.aspx.cs" Inherits="xx.Edit" MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script src="https://js.arcgis.com/4.14/" type="text/javascript"></script>
<script src="../js/index.js" type="text/javascript"></script>
<!-- SNIP -->
<asp:Button ID="btnGISPush" runat="server" OnClientClick="btnGISPush_Click()" Text="GIS Push" CausesValidation="true" /><br />
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer"
], function (Map, MapView,FeatureLayer) {
function btnGISPush_Click() {
console.log("fggfdgfdgdfg");
//document.getElementById('<%= btnGISPush.ClientID %>').click();
alert("somrtindfgdfg");
}
});
... View more
04-02-2020
07:00 AM
|
0
|
9
|
3719
|
|
POST
|
I feel so embarrassed....I wasnt creating the params correctly...I was never calling the parameter by its name so it just used the default. Where "request" was the name of the input parameter as seen in my original post var dictstring = {"employees": [{ "address": "1520 Split Oak Ln, Henrico, Virginia, 23229", "distance": "10", "id": "1" }, { "address": "113 Buffalo Rd, Clarksville, Virginia(VA), 23927", "distance": "50", "id": "4" }, { "address": "8817 Sherando Dr, Bristow, Virginia(VA), 20136", "distance": "20", "id": "5" }]};
dictstringtoPass = dictstring;
gpJSON.execute(dictstringtoPass); var params = {
request: dictstring
};
gpJSON.execute(params);
... View more
04-02-2020
01:15 AM
|
0
|
0
|
1624
|
|
POST
|
think i found it here.. Run a geoprocessing task—ArcGIS Runtime SDK for .NET | ArcGIS for Developers have not done this before an not sure what I have to install along with Visual Studio or reference or include in my code.
... View more
03-31-2020
04:02 PM
|
0
|
6
|
3827
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|