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.
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.
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
Kafil,
Once you have a web service you access the web service using esriRequest to make a REST service call.
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
Kafil,
I am not sure how you are expecting this to work at all. Where in your code are you calling the "fnGetxy"?
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
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?
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