Select and save records from Oracle database

michałk51710037

29-09-2017

Hi,

I'm trying to use Javascript code to retrieve some specific records from Oracle database.

This is simple LiveCycle pdf form with 2 fields and a Button with attached click event and below code:

var inName = TextField1.rawValue

var nIndex = 0;

while(xfa.sourceSet.nodes.item(nIndex).name != "DataConnection")

{

nIndex++;

}

var oDB = xfa.sourceSet.nodes.item(nIndex).clone(1); // the node pertaining to the data connection specified

//app.alert(oDB.saveXML("pretty"));

//set up sql call to DB to get specifics about employee

oDB.nodes.item(1).query.setAttribute("text", "commandType");

oDB.nodes.item(1).query.select.nodes.item(0).value = "Select * from COUNTRIES where COUNTRY_ID = '" + inName + "'";

//app.alert(oDB.nodes.item(1).saveXML("pretty"));

//now connect to DB and get a record

oDB.open()

oDB.close();

So after insert country code in TextField1 and a Button click I obtain corresponding Country_Name in database binded field.

Everything works fine until I try to save the form, after reopen the Country_Name field restores it's default first database record.

I tried to assign the selected record to variable and than use it do write it's value to new static text field, which could be saved, but without success.

The final idea is to open clear or filled previously form insert/reinsert some index and after click find necessary data and save it all, so that when reopened the form is unchanged until next button click.

Any help would be appreciated!

Regards,

Michał

Accepted Solutions (0)