Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Navigating SQL Records in PDF

Avatar

Former Community Member
I am having a problem with navigating/selecting records from a SQL Database. I have a simple PDF form that I need filled in automatically when the user selects a specific records from the database. My ODBC conenction works, I can see the "first" record in the database populates the form correctly (I should note this is a one-way form, it only reads data from the database). My dropdown diplays the first record's data from the database, but when I click the down arror of the dropdown I get an error sound/beep. That's it, nothing else happens. It is bound properly to a field in the query. I have also tried binding the dropdown directly to a table and a also a stored procedure. All have the same result, the dropdown just beeps when you try to use it. Before I brought this product I specifically asked Adobe sales if I could do what I wanted (navigate the database to populate and print the forms.) They said YES, but it appears to be more challenging that a simple "Word Mail Merge" (which I don't want to do!). Any and all suggestions/help is appreciated. Thanks.
4 Replies

Avatar

Former Community Member
Are you testing your form as a preview in Designer? If so have a look at the preview tab on the form properties and see that the form is being render as an interactive form or a print form. My guess is that it is set to print.

Avatar

Former Community Member
Yes, I am testing my form in preview, also in reader as well.

It is set to Interactive. Still beeps when using the dropdown.



Funny thing is that I created a another VERY simple two control item form. One dropdown and one field to check the dropdown is working.

Connected to a table in the database. Same thing. That ugly beep like error sound. ???

Avatar

Former Community Member
I just set up a new database connection, tweaked it every way known to man. Set up a blank form from scratch, published it. etc,etc,etc.... Still not working.



--BEGIN RANT--

HELLO? anyone from ADOBE out there? What magical wand do I have to wave for this to work "as advertised"? or should I just chalk this up to false advertising and switch back to MS Word mail merges? (which, by the way, are pretty damn simple to setup and integrate into SQL databases)

--END RANT--

Avatar

Former Community Member
OK, apoligies for the rant..<br /><br />After much reading and copying I now get the first record to display in the dropdown. Upon further reading this too is a problem shared by many. Most without resolve. here is my javascript behind the dropdown. Showing the initialize and the click.<br /><br />What I now get is only the first record and this error.<br /><br /> Error: null is not an object<br /><br />CODE BELOW<br /><br />----topmostSubform.Page1.DataDropDownList::initialize: - (JavaScript, client) --------------------<br /><br />/* This dropdown list object will populate two columns with data from a data connection.<br /><br /> sDataConnectionName - name of the data connection to get the data from. Note the data connection will appear in the Data View.<br /> sColHiddenValue - this is the hidden value column of the dropdown. Specify the table column name used for populating.<br /> sColDisplayText - this is the display text column of the dropdown. Specify the table column name used for populating.<br /><br /> These variables must be assigned for this script to run correctly. Replace <value> with the correct value.<br />*/ <br /><br />var sDataConnectionName = "BBCC"; // example - var sDataConnectionName = "MyDataConnection";<br />var sColHiddenValue = "ContactAdmin_Key"; // example - var sColHiddenValue = "MyIndexValue";<br />var sColDisplayText = "JobDescription"; // example - var sColDisplayText = "MyDescription"<br /><br />// Search for sourceSet node which matchs the DataConnection name<br />var nIndex = 0;<br />while(xfa.sourceSet.nodes.item(nIndex).name != sDataConnectionName)<br />{<br /> nIndex++;<br />}<br /><br />var oDB = xfa.sourceSet.nodes.item(nIndex);<br />oDB.open();<br />oDB.first();<br /><br />// Search node with the class name "command"<br />var nDBIndex = 0;<br />while(oDB.nodes.item(nDBIndex).className != "command")<br />{<br /> nDBIndex++;<br />}<br /><br />// Backup the original settings before assigning BOF and EOF to stay<br />var sBOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("bofAction");<br />var sEOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("eofAction");<br /><br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayBOF", "bofAction");<br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayEOF", "eofAction");<br /><br />// Clear the list<br />this.clearItems();<br /><br />// Search for the record node with the matching Data Connection name<br />nIndex = 0;<br />while(xfa.record.nodes.item(nIndex).name != sDataConnectionName)<br />{<br /> nIndex++;<br />}<br />var oRecord = xfa.record.nodes.item(nIndex);<br /><br />// Find the value node<br />var oValueNode = null;<br />var oTextNode = null;<br />for(var nColIndex = 0; nColIndex < oRecord.nodes.length; nColIndex++)<br />{<br /> if(oRecord.nodes.item(nColIndex).name == sColHiddenValue)<br /> {<br /> oValueNode = oRecord.nodes.item(nColIndex);<br /> }<br /> else if(oRecord.nodes.item(nColIndex).name == sColDisplayText)<br /> {<br /> oTextNode = oRecord.nodes.item(nColIndex);<br /> }<br />}<br /><br />while(!oDB.isEOF())<br />{<br /> this.addItem(oTextNode.value, oValueNode.value);<br /> oDB.next();<br />}<br /><br />// Restore the original settings<br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sBOFBackup, "bofAction");<br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sEOFBackup, "eofAction");<br /><br />// Close connection<br />oDB.close();<br /><br />----- topmostSubform.Page1.DataDropDownList::click: - (JavaScript, client) -------------------------<br /><br />if (Len(Ltrim(Rtim(SelectField.rawValue))) > 0) then<br /><br /> $sourceset.BBCC.#command.query.commandType = "Text"<br /><br /> $sourceset.BBCC.#command.query.select.nodes.<br /> item(0).value = Concat("Select * from CA_MergeDocs Where ContractAdmin_Key = ",<br /> Ltrim(Rtrim(SelectField.rawValue)) ,"")<br /> <br /> //Reopen the DataConnection<br /> <br />$sourceset.BBCC.open()<br /><br />endif<br /><br />-----------------