Expand my Community achievements bar.

SOLVED

Number of rows in a data view

Avatar

Level 2

Hi,

I have a Data View that is linked to a table in an MS Access database.

How can I determine the number of rows that are in the data view?

Thanks,

Chris

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Ok I see the issue.....starting at version 8 of Acrobat the sourceset Dom has been locked down so that if you try and modify it you will get security errors.

There is a good explantion of this in Stefan Cameron's blog located here:

http://forms.stefcameron.com/2006/12/07/better-form-design-with-xfa-25/

Towards the bottom is a solution for sunning with current versions.

The other option is to target your form for an earlier version where this restrict did not exist. In Form Properties vhoose a target version of 7.0.5 and your code will work just fine (no errors).

Paul

View solution in original post

15 Replies

Avatar

Former Community Member

You can get a count of the repeating Row instances in the table from the instanceManger. The syntax would be somthing like this:

var noOfRows = Table.Row.instanceManager.count

Paul

Avatar

Level 2

Thanks for the reponse but I'm after the number of rows in the DATA VIEW, not a table in the pdf.

Any clues,

Chris

Avatar

Former Community Member

Are you talking about the dataview in Flex? If so I think you are posting to the wronf forum.

Paul

Avatar

Level 2

No, I'm talking about a data view in Life Cycle Designer.  In the attached image I need to find out the number of rows in the remote table 'NRSP_Q4b'.

Any clues?

Thanks,

Chris

Avatar

Former Community Member

Ok Now I understand. There is no distinct javascript command that will give you the count of records in the table. There is a Beginning of File (isBOF) and End of File (isEOF) that will return true/false if you are at the beginning or end. Another option would be to execute a SQL statement that will return the count of records.

Paul

Avatar

Level 2

That is what I feared.  I've tried isEOF in a loop but it just kept on going.

I then found that you needed to ...setAttribute("stayBOF", "bofAction") and ..setAttribute("stayEOF", "eofAction").  I added this but the code bombed on these lines and failed to set the bofAction and eofAction.  That is the subject of another current discussion but unfortunately I haven't received any responses to that.

So I've now put together a small pdf (attached) that shows what I'm trying to achieve (I hope) and the problems that I'm having.

I'm trying to populate a pdf table with records from an external table (on varying number of rows.  To run you will need to create an ODBC Data Source to the enclosed Access mdb.  Mine was called NRSP.

Hopefully you will have the same problems that I'm having.  If not then the errors could be with my computer or setup.  Unfortunately I don't have access to another computer with LifeCycle Designer (I'm using 8.0) to test it on.

PLEASE have a look at the pdf and let me know where I'm going wrong.  I'm tearing my hair out trying to get this to work.

Thanks,

Chris

Avatar

Level 2

My message got through but the attachment didn't so I'll try again.

Avatar

Level 2

Nope no go.  I'm trying to attach a zip gile with a pdf and an MS Access mdb file but it looks as though you don't accept a zip file.  Here is the pdf but this is useless without the data.  How can I send you the .mdb file?

Unfortunately I'm on the other side of the world so to try and get more than one response a day is very difficult.

Chris

Avatar

Former Community Member

Change the extensions to txt and let us know what to change the filename to.

Paul

Avatar

Former Community Member

If that does not work send the zip file to livecycle8@gmail.com  and I will have a look.

Paul

Avatar

Level 2

Okay, here is the 'txt' file.  Rename it back to '.zip'.

Cheers,

Chris

Avatar

Correct answer by
Former Community Member

Ok I see the issue.....starting at version 8 of Acrobat the sourceset Dom has been locked down so that if you try and modify it you will get security errors.

There is a good explantion of this in Stefan Cameron's blog located here:

http://forms.stefcameron.com/2006/12/07/better-form-design-with-xfa-25/

Towards the bottom is a solution for sunning with current versions.

The other option is to target your form for an earlier version where this restrict did not exist. In Form Properties vhoose a target version of 7.0.5 and your code will work just fine (no errors).

Paul

Avatar

Level 2

Brilliant - Stefan solutions worked.

For those others who may view the this thread for LifeCycle Designer 8 you need top use..

     var oDB = xfa.sourceSet.nodes.item(nIndex).clone(1);

so that you can set the 'bofAction' & 'eofAction' attributes.

I must say though that I haven't seen any mention of this anywhere.

Thanks for your help.

Chris

Avatar

Level 2

Well not quite there.

In the first table, 16b,  in the attached file (rename .txt to .zip) column 1 is showing 'Empty' for all rows, even tough the correct value is being returned from the data table.

The data for columns two and three of the pdf table are being retrieved correctly and populated correctly in the table, but column one is not, even though I appear to have everything correct.

Do you have any clues as to why the data ifor column one is not being displayed correctly?

Cheers,

Chris

Avatar

Former Community Member

The file is not getting through the filters ...can you send it to livecycle8@gmail.com ....make sure to reference this post.

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----