Repeating tables

L

Lee Newson

Hi,

i have a form with a view where i have a repeating table (master) and 5
further repeating tables (detail). I know i have to use position() to get
the position in the table, however i am trying to have buttons positioned
under the table that allow me to move to the next record, previous record,
first and last records. The problem i am having though is that i can find
no way to reference the table, and i cannot use the position in the data
source as the table can be filtered in 3 different ways.

this may be a question that has been answered before but i cant find it. is
there a way to reference a table using JScript, and from that create these
buttons, so that they only navigate through the records displayed in the
table?

thank you for any help

regards

Lee
 
L

Lee Newson

Hi Greg,

This worked great thnaks... the only change i had to make to the code (apart
from the obvious; node name and the control name) was that iRow is a string
so after that i put in a new line:

var iRow2 = parseInt(iRow) + 1;

and then changed the last line to:

XDocument.SetNamedNodeProperty(oMasterTable, "CTRL1_5", iRow2);

It took about 20 minutes to put in the code and manipulate it so that it
worked for the previous, last and first record buttons.

(for previous ihad to add an if statement such that it only -1 if
parseInt(iRow) > 1, otherwise iRow would continue to go into minus numbers

thank you for your help it has been very much appreciated.

regards

Lee



"Greg Collins [MVP]" <Greg.Collins_AT_InfoPathDev.com> wrote in message
Lee,

Yes, you can do this. I have an InfoPathDev.com Example I've started, but
haven't had time to finish and post yet that shows how to select a Master
table row using code.

You will need to extract your form files and open the view .xsl file to get
a piece of data for this to work.

Let's say you wanted to hook this code up to the Next Row button, it would
look similar to this:

var oMasterTable = XDocument.DOM.selectSingleNode("//my:group1");
var iRow = XDocument.GetNamedNodeProperty(oMasterTable, "CTRL1_5", 1);
XDocument.SetNamedNodeProperty(oMasterTable, "CTRL1_5", iRow + 1);

Notes:
The my:group1 would be replaced with the node for your Master Table.
From the view .xsl file, you need to get the middle parameter. It can be
found by doing a search for "GetNamedNodeProperty".
The third parameter for Get... is the default value to use in case
nothing is found.
The third parameter for Set... is the value you want to set for this
named node property.

Have fun, and let me know how it works and what you think!!

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



Hi,

i have a form with a view where i have a repeating table (master) and 5
further repeating tables (detail). I know i have to use position() to get
the position in the table, however i am trying to have buttons positioned
under the table that allow me to move to the next record, previous record,
first and last records. The problem i am having though is that i can find
no way to reference the table, and i cannot use the position in the data
source as the table can be filtered in 3 different ways.

this may be a question that has been answered before but i cant find it. is
there a way to reference a table using JScript, and from that create these
buttons, so that they only navigate through the records displayed in the
table?

thank you for any help

regards

Lee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top