Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Gathering info from SQL Database

Avatar

Former Community Member
I want to my users to be able to enter an account number and it return name and address. I have created the Dataconnection and set it to delayed open. The sequal command that i am using is "select * from memb where acct = '" I have it set as an exit command currently but can change it if i need to. It is running on a server and as a formcalc. Do I need to Bind the name and address field to my data connection name and address?
5 Replies

Avatar

Former Community Member
Yes you need to bind the results of your query to the fields on your form.

Avatar

Former Community Member
I keep getting a "Couldn't post data to", Here the script from... What is wrong???



topmostSubform.Page1.P.acct::exit - (FormCalc, server)



xfa.sourceSet.DataConnection.nodes.item(1).query.setAttribute = "text"

xfa.sourceSet.DataConnection.nodes.item(1).query.select.nodes.item(0).value = "Select * from memb where acct = '", this.rawValue, "'")

//app.alert(xfa.sourceSet.DataConnection.nodes.item(1).query.select.nodes.item(0).value);



//now connect to DB and get a record

//xfa.sourceSet.DataConnection.open()

//xfa.host.messageBox ("Data Connection Opened")

Avatar

Former Community Member
You have your code set to run server side but you are not rendering from a server. Change it to run client side.

Avatar

Former Community Member
Okay, I have changed to client and when i Check my script syntax it is not liking this field. Do I need to have it set on formcalc or javascript?



xfa.sourceSet.DataConnection.nodes.item(1).query.select.nodes.item(0).value = "Select * from memb where acct = '" + this.rawValue +