How to retrieve a value from Oracle database when a process initiates?

ok, thanks. As I’m so unfamiliar with Java and in general the “new” world of IT, all this takes time.

Will give it a go.

Kari

There is a problem with the “process-variable” example" though, it will not work in future versions of the software…

Well that’s not strictly true… :slight_smile:

Bonitasoft do not want anyone using process variables (still trying to understand the reason why) in the forms so the test is only valid for those who are Administrators. If you are a normal user this will not work.

This is the way we do it:

One the form create a variable of type JavaScript: return getMyNumber();
getMyNumber is a JavaScript function added as a Page Asset, something like:

function getMyNumber() {
var module = "getMyNumber";
var debug = true; .// set false so you don't get debug messages

if (debug == true) {
	console.log(module + "v01.00");
}
if (debug == true) {
	console.log(module + "Arriving");
}

var xmlhttp;
var gReturn = "No Number Found! Dingbats!";

if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var gRequest;
gRequest = location.origin + "/myWebService/WebService;

if (debug == true) {console.log(module + "gRequest: " + gRequest)};

xmlhttp.open("GET", gRequest, false);
xmlhttp.send();

    if (xmlhttp.status == 200) {
gReturn = xmlhttp.responseText;
if (debug == true) {console.log(module + "gReturn SUCCESS: " + gReturn)};
}
    else {
    if (debug == true) {console.log(module + "gReturn FAILURE: " + gReturn)};
    }

if (debug == true) {
	console.log(module + "Leaving");
}

return gReturn;

And finally:

myWebService/WebService

is an AJAX webservice that you need to write to interrogate your Oracle Database, we do this with PostgreSQL.

A pointer to this can be found here: http://www.vogella.com/tutorials/EclipseWTP/article.html

Works wonderfully well :slight_smile:

regards
Seán

PS: If this reply answers your question, please mark a resolved.