get current row of repeating table in code - InfoPath Dev
in

InfoPath Dev

get current row of repeating table in code

Last post 06-15-2006 03:18 PM by Carolyn. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-14-2006 04:39 PM

    get current row of repeating table in code

    I am using VB.Net code with InfoPath SP2.

    I have a repeating table. I wish to click a button in a given row of the repeating table and insert a value in one of repeating table row text boxes. (Alternatively, change the value in a drop-down with a AfterChange event.)

    I had a tough time figuring out how to make it enter code in any except the first line. That is done with adding a [x] (where x is an integer) in the selectSingleNode query string.

    Fine, dandy.

    Here is my example that works. It puts a 52 into the SumA field in the second repeating row.

    '(following is one line in code)
    thisXDocument.DOM.selectSingleNode("/my:myFields/my:Expenses[2]/@my:SumA").text = "52"

    What I cannot figure out is how to, in code, get the current row. How do I know that if I click a button (or change a drop-down list value) what is the current row of the repeating table so the number will go into SumA of that row?

    TIA
  • 06-14-2006 11:41 PM In reply to

    Re: get current row of repeating table in code

    Hi

    Following link has info to get the current row in repeating table, Hope you find it useful!

    http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=1252
    Madhuri
    http://www.ggktech.com
  • 06-15-2006 03:18 PM In reply to

    Re: get current row of repeating table in code

    quote:
    Originally posted by madhuri
    Following link has info to get the current row in repeating table, Hope you find it useful!



    Thanks, but I have been through a lot of these threads and still can't seem to make it work. I will post specific code examples and hope that someone can tell me what I am doing wrong. I won't be able to do that until later.

    I truly appreciate your help.

    Posted later (6/17/2006)
    After much trial and error (especially error) I got it to work. I am going to post exactly what I did.

    I have a repeating table. I have a combo box in the table, and I wish a running sum (SumA) to be filled when the combo box value is changed. In my simple example, I want Amount to go into SumA.

    The repeating table should look something like this:

    Amount SumA SumB A or B?(dropdown)
    2 2 0 A
    3 0 3 B

    I am working in VB.net.

    I wrote a event handler OnAfterChange for the dropdown box. In this event handler is the following code:

    Dim strAmt As String
    strAmt = e.Site.selectSingleNode("../my:Amount").text
    e.Site.selectSingleNode("../my:SumA").text = strAmt

    I still need to convert to numbers and write code to zero out boxes if the drop-down is changed. I also need the code for the "B" choice. This code snip is the essence of the solution to my problem. The rest is doable.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.