Add column to repeating section, switch views, then add column to a second repeating section - InfoPath Dev
in

InfoPath Dev

Add column to repeating section, switch views, then add column to a second repeating section

Last post 11-02-2011 08:39 PM by Nugget_RK. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 11-01-2011 06:52 PM

    Add column to repeating section, switch views, then add column to a second repeating section

    Using Infopath 2007, VB code

    Hi,
    I have a button on one view which adds a column to a repeating section when clicked, which works fine. What I now want it to do is add to the first repeating section, then switch views and add to a different repeating section. The goal of this is that the second repeating section will have the same number of sections as the first, so that one field from the first section can be displayed in the second section with additional rows of data.

    I have been trying the code below...
    ' add to first section then switch views
    CurrentView.ExecuteAction(ActionType.XCollectionInsert, "SampleInfo_54")
    Me.ViewInfos.SwitchView("Lab Content")

    ' add to second section then switch back to original view
    CurrentView.ExecuteAction(ActionType.XCollectionInsert, "group4_64")
    Me.ViewInfos.SwitchView("Requestor Content")

    The error occurs as it tries to add to the second section, with the following error: "The form's code contains errors. The following call in the form's code failed: View.ExecuteAction Unknown name."
    I'm confused as when I put the second piece of code onto a separate button it adds to the second section without any errors, I just can't do both from the one button on the first view.

    I'm new to Infopath, so any help would be greatly appreciated!

    Cheers,
    Richard

  • 11-01-2011 10:55 PM In reply to

    Re: Add column to repeating section, switch views, then add column to a second repeating section

    How about having putting a repeating section for your group4 group on your "Requestor Content" view, inside a section that's always hidden?  Then you could probably add rows to it without switching views, and the changes would be reflected in your "Lab Content" view.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-02-2011 01:40 PM In reply to

    Re: Add column to repeating section, switch views, then add column to a second repeating section

    Thanks Jimmy, that works perfectly.

    Is it easy for me to bind one field of the second repeating section to a field in the first? I want it to always display the correct value of the corresponding section in the sequence (i.e: the value in the first column of the first repeating section is displayed first column of the second repeating section, the value in the second is the same in both, the value in the 3rd columns is the same, etc....)

    Sorry if the above is a little confusing, it's difficult to put into words when I don't know the correct way to describe the controls and their components.

  • 11-02-2011 01:52 PM In reply to

    Re: Add column to repeating section, switch views, then add column to a second repeating section

    Yes, that should be possible, but if you're going to go that far, is there a reason to have two separate repeating groups?  Is there a reason not to have just one that you display in both views?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-02-2011 01:59 PM In reply to

    Re: Add column to repeating section, switch views, then add column to a second repeating section

    The second repeating section has only one field from the first repeating section, but additional rows of information. Could I just have one repeating section that has all possible rows in it, copy it and paste it on the various views, then hide/unhide the applicable rows depending on which view it's on?

  • 11-02-2011 08:39 PM In reply to

    Re: Add column to repeating section, switch views, then add column to a second repeating section

    I've set up the repeating sections using the Default Values, then using conditional formatting to hide the excess sections unless required. How do I configure the "Unit" field in the second repeating section to pull a field value from the first? At the moment it just repeats the first value across every instance.

Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.