Quantcast
Channel: Adobe Community : Popular Discussions - LiveCycle Forms
Viewing all articles
Browse latest Browse all 61369

Drop-down list to pull in Access record

$
0
0

Hi -

 

I am a newby at this so please bear with me.  I know this have been addressed a hundred times but I can't seem to find anyone else who is having this specific issue.

 

I have v8.2.

 

Since my scripting wasn't working, I downloaded the "Adobe LiveCycle Designer 7.0, providing interactive database lookup from forms" document to try and see if I can figure out what is going on.

 

I built exactly as in document with exception of adding "clone(1)" as needed based on what I found in other postings about v8.2 and premission errors.

 

Dropdown box:

/* 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.

*/

var sDataConnectionName = “DataConnection”;

var sColHiddenValue = “ID”;

var sColDisplayText = “PART_NO”;

// 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).clone(1);

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;

for(var nColIndex = 0; nColIndex < oRecord.nodes.length; nColIndex++)

{

if(oRecord.nodes.item(nColIndex).name == sColHiddenValue)

{

o

ValueNode = oRecord.nodes.item(nColIndex);

}

else if(oRecord.nodes.item(nColIndex).name == sColDisplayText)

{

o

TextNode = oRecord.nodes.item(nColIndex);

}

}

while(!oDB.isEOF())

{

this.addItem(oValueNode.value, oValueNode.value);

//IDList.addItem(oValueNode.value, oTextNode.value);

oDB.next();

}

// Close connection

oDB.close();

 

Button:

if (Len(Ltrim(Rtrim(SelectField.rawValue))) > 0) then

$sourceSet.DataConnection.clone(1).#command.query.commandType = “text”

$sourceSet.DataConnection.clone(1).#command.query.select.nodes.item(0).value = Concat(“Select * from OfficeSupplies Where ID = “, Ltrim(Rtrim(SelectField.rawValue)) ,””)

//Reopen the Dataconnection

$sourceSet.DataConnection.clone(1).open()

endif

 

Preview PDF and it connects correct, drop down box populates correctly, but when I click the button, it ALWAYS populates data from first record (no matter what is selected in drop down box).  This is the same issue I had with my own build.

 

Anyone have any ideas what I have wrong?

 

Thanks!

Misty


Viewing all articles
Browse latest Browse all 61369


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>