WebAppBuilder - Query Oracle Database

1449
12
03-24-2019 04:47 AM
KafilBaig
New Contributor III

Hey, I am very new  to WebApp Builder. I have a requirement where i need to query from Oracle Database and show the result in widget. Is this posibble to do .

In the tabular data i need to have a button on that click it should zoom that point .

Thanks in Advance.

0 Kudos
12 Replies
RobertScheitlin__GISP
MVP Emeritus

Kafil,

   The JS API does not have the ability to query a database on a server without the use of a web service so the short answer is no it is not possible without a web service that allows for this.

0 Kudos
KafilBaig
New Contributor III

Thanks for the feedback

If i create a Webservice project to fetch data from Oracle Database. How how i need to access a webservice in the widget where i have search parameters and table to show the data

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kafil,

  Once you have a web service you access the web service using esriRequest to make a REST service call.

0 Kudos
KafilBaig
New Contributor III

Thanks Robert ,

Do u have a sample code for this. If yes please share the sample code.

Thanks in advance for ur help

Sent from my iPhone

0 Kudos
KafilBaig
New Contributor III

Hi Robert,

I have created a webservice and trying to access in zoomgrid widget with no success. Can you please check the code and help me out where there is a mistake .

Please find attached zoomgrid widget altered by me.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kafil,

  I am not sure how you are expecting this to work at all. Where in your code are you calling the "fnGetxy"?

0 Kudos
KafilBaig
New Contributor III

On the button click am calling the function"fnGetxy" . I am getting the error in console as typeError "a.haschildnode".

Please find attached complete widget for your reference.

Also i tried the same code in html page with EsriRequest and WebApi there i get results but not in widget. In this am using 4.12 javascript api but in widget it is 3.27 

The below code works fine for me .

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">

<title>Find Task - 4.2</title>

<style>

td {

padding: 4px;

}

#loading {

visibility: hidden;

}

</style>

<script src="https://js.arcgis.com/4.2/"></script>

<script>

require([

"esri/request",

"esri/config",

"dojo/json",

"dojo/dom",

"dojo/on",

"dojo/domReady!"

], function(esriRequest, esriConfig, JSON, dom, on) {

esriConfig.request.proxyUrl = "https://gislap183/js/proxy/proxy.ashx";

function doRequest(){

var url = "https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/layers?f=json";

esriRequest(url, {

responseType: "json",

callbackParamName: "callback"

}).then(function(response){

showResults(response);

});

}

var resultsTable = dom.byId("tbl");

// Executes when the promise from find.execute() resolves

function showResults(response) {

var results = response.data;

// Clear the cells and rows of the table to make room for new results

resultsTable.innerHTML = JSON.stringify(results);

}

// Executes each time the promise from find.execute() is rejected.

function rejectedPromise(err) {

console.error("Promise didn't resolve: ", err.message);

}

// Run doRequest() when button is clicked

on(dom.byId("execBtn"), "click", doRequest);

});

</script>

</head>

<body>

<input type="button" value="Execute" id="execBtn" />

<br>

<br>

<table id="tbl"></table>

</body>

</html>

Thanks in advance for your help

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kafil,

   You say 

I am getting the error in console as typeError "a.haschildnode".

Where are you getting this error? Are you getting into the succeed function or the error function?

0 Kudos
KafilBaig
New Contributor III

Hi Robert,

Sorry to bother you again and again.

Now that error is not coming as a.hasChildNode. But getting other error as esriRequest.Then is not a function.

I tried many options with no luck but couldn't resolve the error of esriRequest.then is not a function.

Please help me to get this issue resolved.

I am using webappbuilder developer edition 2.11 for which arcgis javascript api is 3.27.

Please find attached error snapshot and widget.js file.

Thanks in advance for your help.

Regards,

Kafil

0 Kudos