T
Tim Larson
After a lot of pain and suffering I finally figured out how to make a
repeating table that only has a fixed number of rows. Each time you push an
insert button a row is added to the top of the table and the rest scroll down
knocking the last row off the table. I saw other posts from people attempting
to do the same so I thought I would post it here. I did use vb.net managed
code.
First you have to place your repeating table on your form and a button for
inserting a new row.
Right click the button > properties > edit form code to open the visual
studio 2003.
Dim nodeRowStart As IXMLDOMNode =
thisXDocument.DOM.selectSingleNode("//my:Labs/my:Heme[1]")
thisXDocument.View.SelectNodes(nodeRowStart, Type.Missing,
Type.Missing)
' insert the row insert before will place it on top.
thisXDocument.View.ExecuteAction("xCollection::insertBefore",
"Heme_1")
Right Click the repeating table > properties > unclick show insert. Hit OK.
On the task panel choose data source >
Highlight your repeating table > right click > choose validation and event
handlers > under events drop down list select
Onafterchange > click edit to open visual studio. Insert code after the end
if for return to global state:
Dim RowsWanted As String = 5 'enter the number of rows wanted in your table
+ 1
Dim nodeTarget As IXMLDOMNodeList =
thisXDocument.DOM.selectNodes("//my:Labs/my:Heme/.")
Dim count As String = nodeTarget.length 'number of rows nodes in
IXMLDOMNodeList
Dim RowCountString As String = "//my:Labs/my:Heme[position()=" +
count + "]" 'xpath for last row in table
If count = RowsWanted Then
'remove the last row
Dim nodeRowEnd As IXMLDOMNode =
thisXDocument.DOM.selectSingleNode(RowCountString)
thisXDocument.View.SelectNodes(nodeRowEnd, Type.Missing,
Type.Missing)
thisXDocument.View.ExecuteAction("xCollection::remove",
"Heme_1")
Hope this helps someone else. Tim Larson
repeating table that only has a fixed number of rows. Each time you push an
insert button a row is added to the top of the table and the rest scroll down
knocking the last row off the table. I saw other posts from people attempting
to do the same so I thought I would post it here. I did use vb.net managed
code.
First you have to place your repeating table on your form and a button for
inserting a new row.
Right click the button > properties > edit form code to open the visual
studio 2003.
Dim nodeRowStart As IXMLDOMNode =
thisXDocument.DOM.selectSingleNode("//my:Labs/my:Heme[1]")
thisXDocument.View.SelectNodes(nodeRowStart, Type.Missing,
Type.Missing)
' insert the row insert before will place it on top.
thisXDocument.View.ExecuteAction("xCollection::insertBefore",
"Heme_1")
Right Click the repeating table > properties > unclick show insert. Hit OK.
On the task panel choose data source >
Highlight your repeating table > right click > choose validation and event
handlers > under events drop down list select
Onafterchange > click edit to open visual studio. Insert code after the end
if for return to global state:
Dim RowsWanted As String = 5 'enter the number of rows wanted in your table
+ 1
Dim nodeTarget As IXMLDOMNodeList =
thisXDocument.DOM.selectNodes("//my:Labs/my:Heme/.")
Dim count As String = nodeTarget.length 'number of rows nodes in
IXMLDOMNodeList
Dim RowCountString As String = "//my:Labs/my:Heme[position()=" +
count + "]" 'xpath for last row in table
If count = RowsWanted Then
'remove the last row
Dim nodeRowEnd As IXMLDOMNode =
thisXDocument.DOM.selectSingleNode(RowCountString)
thisXDocument.View.SelectNodes(nodeRowEnd, Type.Missing,
Type.Missing)
thisXDocument.View.ExecuteAction("xCollection::remove",
"Heme_1")
Hope this helps someone else. Tim Larson