Expand my Community achievements bar.

Populating a table from an Ole data command

Avatar

Level 2

Hi,

I'm Using LifeCycle Designer 8.0 and I'm trying to populate a table in my form with data from an OLE database.

The OLE table has any number of rows and by binding each text field in the pdf table with a column from the data connection, only the first row of data in the table is being displayed in the pdf table.  I'm trying to add code to cycle through each row of the data view and add the values to the pdf table.

I've found this code from Stefan and I've added it to the initialize event for the table. The data view name of the table is NRSP_Q4a1.

----- Data.Sec4.Subform2.Table4a1::initialize: - (JavaScript, client) ------------------------------

var

oDB = xfa.sourceSet.NRSP_Q4a1;

oDB.open();

oDB.first();

var

nDBIndex = 0;

while

(oDB.nodes.item(nDBIndex).className != "command")

{

     nDBIndex

++;

}

// Backup the original settings before assigning BOF and EOF to stay

var

sBOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("bofAction");

var

sEOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("eofAction");

xfa.host.messageBox("sBOFBackup, sEOFBackup = "

+ sBOFBackup + ", " + sEOFBackup);

oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayBOF"

, "bofAction");

oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayEOF"

, "eofAction");

var

sbof = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("bofAction");

var

seof = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("eofAction");

xfa.host.messageBox("sbof, seof = "

+ asbof + ", " + seof);

while

(!oDB.isEOF())

{

     Table4a1.Row1.instanceManager.addInstance(1);

     oDB.next();

}

The bofAction returned is 'moveFirst and the eofAction is 'moveLast'.

But trying to set the actions to 'stayBOF' and 'stayEOF' repectively, fails.  Should this setAttribute command be in the initalize event or some other event?  Any clues as to why this section is not working?

Also I'm not sure what to do in the next stage.  The While loop I have is, unfortunately, un-tested, but I need to add a new row for each row in the data view and then populate that row with the values.  Am I on the right track?  If not how d you do it?

Thanks for any help.

Chris

The bofAction returned is 'moveFirst and the eofAction is 'moveLast'.

But trying to set the actions to 'stayBOF' and 'stayEOF' repectively, fails.  Should this setAttribute command be in the initalize event or some other event?  Any clues as to why this section is not working?

Also I'm not sure what to do in the next stage.  The While loop I have is, unfortunately, un-tested, but I need to add a new row for each row in the data view and then populate that row with the values.  Am I on the right track?  If not how d you do it?

Thanks for any help.

Chris

0 Replies