Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Next Matching Record -- PLEASE HELP

Avatar

Former Community Member

Hello, I'm really BEGGING for your help. I'm praying that someone would answer. I managed to connect to a database, and view a record after I search for it. However, it's only pulling one record. I want to create a button to display the next matching record. PLEASE HELP... I"M BEGGING!

  The search button code is below and it's working but only displaying one record:

var inName = app.response("Enter the WATER ACCOUNT NUMBER of the User you are looking for: ");
if (inName == ""){
app.alert("You must enter a valid ACCOUNT NUMBER - try again!")
}
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 Table1 where ACCOUNT = '" + inName + "'";
app.alert(oDB.nodes.item(1).saveXML("pretty"));

//now connect to DB and get a record
oDB.open()

 

PLEASE HELP

1 Reply

Avatar

Level 10

Hi,

For databases the best resource for explanation and examples is at Stefan Cameron's site: http://forms.stefcameron.com/.

Just do  search on his site for database.

Or someone else may be able to help here.

Good luck,

Niall