Repeating Section - InfoPath Dev
in

InfoPath Dev

Repeating Section

Last post 08-03-2009 11:03 AM by Bill . 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 07-31-2009 08:50 AM

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    Repeating Section

    I have a repeating section that on insert on a new section, it insert a new row into my main data source.  I can then add data to the new record w/o issues.  However, I have a series of check boxes and I have added a button to flag them all false if the user wants.  My issue is if I click on the control it only completes the transaction on the first record in my repeating section.  How can I use this control on each newly inserted section or how can I move the record pointer so that the fields on the newly inserted section are the ones that get evaluated?

     Thanks!

     

    Bill

    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 07-31-2009 09:15 AM In reply to

    Hi,

    Where is your button located? Is it in the same repeating section? Or outside of the repeating seciton? What actions do you have in the rule on the button?

    I've attached a sample template. Right click the link in the message header and save the file locally. Then right click and open in design and preview. Add a bunch of sections, click the button to set all check boxes to true.

    Hilary Stoupa

  • 07-31-2009 10:09 AM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    My button is in the repeating section.  I will look at your code and see where we differ and get back with you.

    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 07-31-2009 10:49 AM In reply to

    Oh, I don't have any code in that -- it was just a simple form with a button and a rule. I may have greatly underestimated what you are trying to do -- but if your button is outside your repeating section and the action is to set the field the checkboxes are bound to as 'true', your button will set all the fields. If it is inside the repeating section, it will only update the field inside the repeating section. I think of it as the buttons 'knowing' where they are, which is probably goofy. :)

    Hilary Stoupa

  • 07-31-2009 11:53 AM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    Still not working having button outside the repeating section.  Maybe it is my code, see snippette.  I fire this code off on click of the button:

    thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:ADHS3243/@Q8OthIncYesNo1a").text = "N"

    thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:ADHS3243/@Q8OthIncYesNo2a").text = "N"

     It works fine with the first record, however it never seems to find the next next repeating section that has been eneterd.  Any ideas what I am doing wrong?

     

     

     

    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 07-31-2009 12:00 PM In reply to

    Yes, this will always set the value of the first node. You'll need to select the list of @Q8OthIncYesNo2a nodes and set the value for each of them.

     For example (note, I'm just 'freehanding' this and could easily have compilation errors, but it will give you the idea):

    IXMLDOMNodeList nodes =  thisXDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/d:ADHS3243/@Q8OthIncYesNo1a");

    foreach (IXMLDOMNode node in nodes)
    {
       node.text = 'n';
    }

    Hilary Stoupa

  • 07-31-2009 12:12 PM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    Great Idea!!!!  That should work!

    I see why Patrick brags about you....... 

     

    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 07-31-2009 12:48 PM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    OK...

     

    Here is my code:

    Dim nodes As MSXML2.I�MLDOMNodeList

    Dim node As MSXML2.I�MLDOMNode

    Dim i As Int16

    Dim strField As String

    nodes = thisXDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/d:ADHS3243/@Q8OthIncYesNo1a")

    For Each node In nodes

    node.text = "N"

    Next

     

    When I run it I get the following error:

    Unable to cast object of type Microsoft.Office.Interop.InfoPath.SemiTrust.DOMNodeListWrapper' to type MSXML2.IXMLDOMNodeList'.

    at DHS3243.DHS3243.CTRL650_10_OnClick(DocActionEvent e) in \\Lsasgm01\goldmine\GMForms\DHS3243\DHS3243\FormCode.vb:line 442

    at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

    Can you help one last time??

    Thanks!

    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 07-31-2009 12:58 PM In reply to

    IXMLDOMNode and NodeList are from Microsoft.Office.Interop.InfoPath.SemiTrust. Your form code should have an imports statement like this at the top:

    Imports Microsoft.Office.Interop.InfoPath.SemiTrust

    Then try:

    Dim nodes As IXMLDOMNodeList

    Dim node As IXMLDOMNode

    Dim i As Int16

    Dim strField As String

    nodes = thisXDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/d:ADHS3243/@Q8OthIncYesNo1a")

    For Each node In nodes

    node.text = "N"

    Next

    Hilary Stoupa

  • 07-31-2009 01:08 PM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    That worked....

    Thanks for all of your help 

     

    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 08-03-2009 11:01 AM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    Hillary,

     

    Thanks again and here is my final code to handle the mutiple check boxes that I have:

    Dim nodes As Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNodeList

    Dim node As Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode

    Dim i, x As Int16

    For i = 1 To 13

    For x = 1 To 3

    nodes = thisXDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/d:ADHS3243/@Q8OthIncYesNo" & x & "a" & i)

    For Each node In nodes

    node.text = "N"

    Next

    Next x

    Next i

     

    If you have any suggestions, please let me know otherwise, thanks gain!!!

    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 08-03-2009 11:03 AM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    Here is my final code:

    Dim nodes As Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNodeList

    Dim node As Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode

    Dim i, x As Int16

    For i = 1 To 13

    For x = 1 To 3

    nodes = thisXDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/d:ADHS3243/@Q8OthIncYesNo" & x & "a" & i)

    For Each node In nodes

    node.text = "N"

    Next

    Next x

    Next i

     

    If you have any suggestions please let me know, otherwise, thanks for all of your help!

    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
Page 1 of 1 (12 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.