Current Row in repeating table - InfoPath Dev
in

InfoPath Dev

Current Row in repeating table

Last post 04-24-2009 11:19 AM by hortonhouse. 31 replies.
Page 1 of 3 (32 items) 1 2 3 Next >
Sort Posts: Previous Next
  • 07-19-2005 09:13 AM

    Current Row in repeating table

    I was looking at one of your examples on the web and thought that you might know how to achieve the following:



    I have a repeating table in Infopath and I need to be able to get the current rows value i.e. the user is inside the 6th row and clicks on the checkbox, which then fires the onAfterChange event, I then need to get the 6th's rows database id to call a stored procedure. I need to get the row position in the Javascript code, is this possible?

    Ideally I would like to have a button on each row, and find the row from this but I have been told that this is not possible.

    Many Thanks
  • 07-19-2005 09:35 AM In reply to

    Re: Current Row in repeating table

    When an OnAfterChange event fires for a control in a repeating table/section, the eventObj for that event is already relative to the current row. So for example, if you have a data structure like this
    Table
    Row
    DatabaseId
    TextBox
    CheckBox
    Button


    If you select the check box, you can simple use a relative XPath to get the DatabaseID such as:

    eventObj.Site.selectSingleNode("../DatabaseID").text;

    The button itself, when clicked simply points to the Row itself. Thus you can reference any of the children of that Row as such:

    eventObj.Source.selectSingleNode("DatabaseID").text

    - - - - -

    If you are looking to find the row number when clicking on a button, you can use a count of previous "Row"s like this:

    var nCount = eventObj.Source.selectNodes("preceding-sibling::Row").length + 1;

    Greg Collins [InfoPath MVP]
    InfoPath Dev
  • 08-10-2007 08:59 AM In reply to

    Re: Current Row in repeating table

    i couldnt get this example to work

    however this does work for me:

     

     var x = eventObj.Site.selectSingleNode("../@my_table_id").text;

     

    dont forget the @, makes for good syntax  !

  • 08-16-2007 03:34 PM In reply to

    Re: Current Row in repeating table

    Just to clarify (for XPath newbies), the "@" character stands for "attribute" as opposed to "element". You are required to use the @ when you are accessing an attribute.

    So

    /XPath/@attribute-without-a-namespace

    /XPath/@my:attribute-with-a-namespace

    If this were an element instead of an attribute it would be:

    /XPath/element-without-a-namespace

    /XPath/my:element-with-a-namespace

    Hope that helps clarify for any newbies.

  • 12-18-2007 02:25 PM In reply to

    Re: Current Row in repeating table

    I'm one of those newbies.  I have a repeating table with a button in each row.   I'd like the button when pushed to write the value of a field in the same row to a field outside the repeating table.    There is no eventObj on the clicked event of the button.     I'm using C#.  (newbie at that as well :)

     Thank you for your help.  

    Brad Overton

  • 12-19-2007 09:29 AM In reply to

    Re: Current Row in repeating table

    "eventObj" is for script. Managed code (C#, VB) uses "e".

    Try e.Source

  • 12-19-2007 12:18 PM In reply to

    Re: Current Row in repeating table

    thank you that worked.   

  • 12-20-2007 10:16 AM In reply to

    Re: Current Row in repeating table

    Great! Glad to have helped!

  • 07-03-2008 11:44 AM In reply to

    Re: Current Row in repeating table

    Hello Greg:

    I also have a repeating table with a button in one of the column. The button is use to launch a Forms window when click. When the button is click I instantiate a global variable that stores one of the value from columns (field) in the current row to display it on the windows form.

    Here is my code (VB.NET):

           Public Sub ButtonGetDescription_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)

                IsBillable = e.Source.SelectingNode("my:Billable").Value

                Dim FormDescription As New FormDescription
                With FormDescription
                    .StartPosition = FormStartPosition.CenterParent
                    .ShowDialog()
                End With

            End Sub

    The e.Source.SelectingNode("my:Billable").Value seems no error, but when I run the code it throws exception.

    Thanks!

     


     

     

     

  • 07-03-2008 12:31 PM In reply to

    Re: Current Row in repeating table

    My code actually works...

    Sorry... my bad :D

  • 07-14-2008 10:54 AM In reply to

    Re: Current Row in repeating table

    No problem. Thanks for the update. Glad to hear its working!

  • 10-01-2008 12:02 PM In reply to

    Re: Current Row in repeating table

    Hi Greg,

     

    I am having trouble addressing the child nodes from the current row. I am using a check box event in a repeating table. My code is as follows:

                IXMLDOMNode WAKeyCurrent = e.Site.selectSingleNode("..").firstChild; // This works and returns the first child node correctly, but how do I get to any node but the first or last?

                I am trying to get a date node that is thrid element in the row. I have tried other elements as well, but get nothing.

               // I have tried the following but they all return a null

                IXMLDOMNode t3a = e.Site.selectSingleNode("reportDate");
                IXMLDOMNode t3b = e.Site.selectSingleNode("../reportDate");
                IXMLDOMNode t3c = e.Site.selectSingleNode("/WAPrimary/reportDate");
                IXMLDOMNode t3d = e.Site.selectSingleNode("/WALookupDS/WAPrimary/reportDate");

                IXMLDOMNode t3a1 = e.Site.selectSingleNode(".."); // this returns the parent node
               

    I am using a Web Service to populate the repeating table and this is a Secondary data source.

     Any ideas would be helpful.

    Thanks

  • 11-19-2008 06:10 PM In reply to

    Re: Current Row in repeating table

    Hi Greg

    I have a repeating table with 7 rows. I have radio button in each row. I need to get value for prospect id (one of columns in repeating table) from the row that I have clicked. So if i have clicked on 4th row then i need to get prospectid of 4th row.

     Please let me know how to do that?

     Thanks

  • 11-19-2008 11:44 PM In reply to

    Re: Current Row in repeating table

    Hi, 

    This you can do by setting the rules for the check box in the repeating table.

    ·         Please follow the below steps for implementing your functionality.

    o   Open the check box properties --> Rules --> Add --> Set Condition.

    o   Now apply the below condition and click on “Ok”.

    Eg: checkboxfield = "yes".

    o   Now apply the action, for this select "Add Action" --> Set a field's value.

    o   Select the field in which you want to set the "prospectid" field value in the "Field" text box.

    o   After that select the "prospectid" field in the "Value" text box. Click “Ok”.

    I hope the above steps help you for solving your problem.

     If you want to get the "prospectid" field value into your code for doing the manipulations. Please let me know so that I can definitely give you the sample code.

     

    Chandrakanth/GGKTech
  • 11-20-2008 05:30 AM In reply to

    Re: Current Row in repeating table

    That didn't solve the problem. Here is what I want to do -:

    I have a radio button in repeating table that has 7 rows. its one radio control that repeat itself  I want to select one radio button. As soon as I select one radio button all of 7 of them will get selected. I only want the one to be selected that I clicked on and rest 6 of them should not get selected.

     

Page 1 of 3 (32 items) 1 2 3 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.