These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Please help with merging database fields to pdf form! simple fix?

jdgower15
Registered: Sep 28 2008
Posts: 6

Hi, so I have been trying to figure this out for a while and it probably seems simple to whoever is reading this, but i am a total amateur with this stuff.

I have a database, say with the following columns: client_code, first, middle, last

I want to be able to call the row by client_code and fill in the rest of the form (first, middle, last names) automatically from that.

I have modified my form from:
http://www.adobe.com/devnet/livecycle/articles/lc_designer_db_lookup_tip.pdf

It works fine with one exception, I want my client_code to be something like "GOWER-1", but when I change the "ID" that this form calls from from 'autonumber' in access to 'text', it makes the whole thing not work. There has to be something in the code for the 'selectfield' that i can change to make this work, but I cant find it? please help! :(

Thanks in advance!

My Product Information:
Acrobat Pro 9.0, Windows
noahzenzen
Registered: Sep 27 2008
Posts: 3
Hi,

I'm very new to acrobat forms and it sounds like your attempting to do the same thing as I am. At first glance your a bit farther and I was wondering if you might be able to get me started.

I have an excel document that has columns of data (name, business name, address, city, etc...). I want to be able to create a batch process that scans each row in the spreadsheet and imports the data from each row into an acrobat form.

I've done a ton of searching online and the only thing that I really see is exporting data to excel or some other kind of importing data to a pdf.

Is there any help that you might be able to give? Does my question make any sense?

Thanks so much, I'm starting to pull my hair out and I don't have much to begin with! :-)
jdgower15
Registered: Sep 28 2008
Posts: 6
First of all, noahzenzen...like I said, I'm an amateur, that's understating it a bit. After looking around, though, I came up with the idea that I dont think I can populate a form with an excel document. I went with an access database and my only suggestion would be to do what I did and go to the link I gave above and copy it, then change it to meet your needs....but just as my question goes, something in that code makes it only work if the "ID" column that the code searches for in the database is in 'autonumber' or 'number form'.

If anyone wants to help me, here's the javascript in my 'selectfield' box...I'm just totally oblivious with this. Thanks!:


topmostSubform.Page1.SelectField::initialize - (JavaScript, client)
/* This listbox object will populate two columns with data from a data connection.

sDataConnectionName - name of the data connection to get the data from. Note the data connection will appear in the Data View.
sColHiddenValue - this is the hidden value column of the listbox. Specify the table column name used for populating.
sColDisplayText - this is the display text column of the listbox. Specify the table column name used for populating.

These variables must be assigned for this script to run correctly. Replace with the correct value.
*/

var sDataConnectionName = "DataConnection"; // example - var sDataConnectionName = "MyDataConnection";
var sColHiddenValue = "Code"; // example - var sColHiddenValue = "MyIndexValue";


// Search for sourceSet node which matchs the DataConnection name
var nIndex = 0;
while(xfa.sourceSet.nodes.item(nIndex).name != sDataConnectionName)
{
nIndex++;
}

var oDB = xfa.sourceSet.nodes.item(nIndex);
oDB.open();
oDB.first();

// Search node with the class name "command"
nIndex = 0;
while(oDB.nodes.item(nIndex).className != "command")
{
nIndex++;
}

// Need to set BOF and EOF to stay
oDB.nodes.item(nIndex).query.recordSet.setAttribute("stayBOF", "bofAction");
oDB.nodes.item(nIndex).query.recordSet.setAttribute("stayEOF", "eofAction");

// Search for the record node with the matching Data Connection name
nIndex = 0;
while(xfa.record.nodes.item(nIndex).name != sDataConnectionName)
{
nIndex++;
}
var oRecord = xfa.record.nodes.item(nIndex);

// Find the value node
var oValueNode = null;
var oTextNode = null;


while(!oDB.isEOF())
{
this.addItem(oValueNode.value, oValueNode.value);
//IDList.addItem(oValueNode.value, oTextNode.value);
oDB.next();
}

// Close connection
oDB.close();
jdgower15
Registered: Sep 28 2008
Posts: 6
nobody knows how to do this? please help :(