[Solved] Create a Repeating Table based on whether another repeating table entry is not blank - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

[Solved] Create a Repeating Table based on whether another repeating table entry is not blank

Last post 03-09-2009 08:23 AM by drake. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 02-27-2009 09:47 AM

    • drake
    • Not Ranked
      Female
    • Joined on 02-27-2009
    • Minneapolis
    • Posts 22

    [Solved] Create a Repeating Table based on whether another repeating table entry is not blank

    I had a hard time searching for this one.

    Some quick background, I have a device and applications changes section in a form for project support transition.  In it is a repeating table for device additions.  One of the fields is Device Name. 

    What I want to do is when the Device Name field is not blank (someone put in a device name), it pops up a new table asking for additional information in regards to the support of the hardware (vendor, contracts, etc.).  That sounds easy and all, but I need it for each device name entered for each row in the repeating table. 

    Is there a way to generate a new table based on a field of a repeating table for each row created by the user?  Is this even possible?

  • 03-02-2009 09:07 AM In reply to

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    It's definatly posible by codding it in C#.

    In case if you looking for codeless solution: If under "generate a new table" you mean "make the other part of my repeating structure visible" then yes, it's posible .

    .

  • 03-02-2009 09:31 AM In reply to

    • drake
    • Not Ranked
      Female
    • Joined on 02-27-2009
    • Minneapolis
    • Posts 22

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    There are a few different routes I'm thinking about now.

    So in the device add column, if someone enters something in, I want a new table (or section) to become visible and allow them to enter in hardware support information.  Which I can get to work for only one row.  If someone adds a new row for an additional device, then my hardware support information disappears because now there is a device name field that is now blank.  So until someone enters in the device name for the second device the hardware support stays hidden.

    What I was thinking of now, is if device name is not blank then, create a new section with the pre-populated deivce name as a header.  But I just have no idea where to even start on something like that.  I've spent another 3-4 hours googling today, but still no matches (or anything I could understand).

    Oh, I am using jscript for the programming now, since I was able to find other tasks with working .js versions opposted to c#.

  • 03-02-2009 08:54 PM In reply to

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    Hi -- I hope I'm not oversimplifying, but can't you just use conditional formatting? I've attached an IP2007 sample....

    Hilary Stoupa

  • 03-04-2009 06:40 AM In reply to

    • drake
    • Not Ranked
      Female
    • Joined on 02-27-2009
    • Minneapolis
    • Posts 22

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    That way would work, but I need the data to be moved into another area. But I think you solved my problem!
     

    Thanks a ton!!

  • 03-04-2009 06:54 AM In reply to

    • drake
    • Not Ranked
      Female
    • Joined on 02-27-2009
    • Minneapolis
    • Posts 22

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    Actually, I'm having the same problem I did before.  In your form, I can add as many rows as I want without the conditional fields hiding again.  When I try it on my form, anytime someone adds an additional device, the hardware information goes back into hiding until someone enters in the device name again on the new row.

    Does that mean I have to have my hardware support information in the same table as the device addition?

    What I want to do, is each time someone enters in a device name in the Device Adds area, that device name is then "transferred" (copied) into a new table/section/drop-down/whatever.  But I can't figure out how to do it for *each* device added.

     Here's a screen shot, hope this helps explain it better then I can.

     

  • 03-04-2009 07:58 AM In reply to

    • drake
    • Not Ranked
      Female
    • Joined on 02-27-2009
    • Minneapolis
    • Posts 22

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

     I think my biggest problem is not being able to make anything unique.  It only seems to pull the first item or the last item in the Device Name field if I use conditional formatting. 

    Now another problem I'm running across is having to ask questions in response to other questions.  Like the Vendor support, if they answer Yes, I now need to ask about contract numbers and some other things.  If they answer No, well now I need to know who the vendor is and ask other support questions.

    So thinking about another solution, is it possible that for each device name entered, a new section could be created with the Device Name as a title and then I could use more static ways of asking the other questions.

  • 03-05-2009 06:38 PM In reply to

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    Here you have hit a wall with what comes out of the box with out of the box InfoPath functionality -- you won't know how many you need of the repeating group you'd be copying the 'Device Name' into until the user is done adding the devices, right?

    I still think that schema-wise, though, I'd only have one group for device. That device group would have fields like device name, etc, and another group inside it for Vendor information, and other groups as needed for additional device related information. I'd connect all my repeating sections / tables to my device group, and simply add and remove fields and columns until it looked the way I needed it to. Does that make sense? Then you can use conditional formatting to show or hide rows in the table or section as needed -- along the lines of 'if the device is not hardware, hide this row'.

    Hilary Stoupa

  • 03-06-2009 03:38 AM In reply to

    • drake
    • Not Ranked
      Female
    • Joined on 02-27-2009
    • Minneapolis
    • Posts 22

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

     I think I solved this by using a repeating section.  It's kind of a ghetto fix, but it works.

    I created a "Hardware Support" section with a button to "Add Hardware Support".  When clicked, it creates a repeating section with a drop down list within the "Hardware Support" root section.  The drop down is then populated with the Device Names from the "Device Add" section above.  I used conditional formatting so when the drop down is not blank, the repeating section is visible.  Hooray!

     

    But then I found out yesterday the InfoPath Forms Services doesn't support jscript (or isn't configured to), super.  Then I found out it doesn't support any form of programming, even more super...  And of course I've been using InfoPath 2007, which was a mistake as everyone here has 2003.  I turned on compatibility and it tells me what isn't supported, but I can't find out where the items are in my form to get rid of them!  ARGH!  And to add insult to injury, I can't open the form in 2003 as it says it was made with a newer version.

    But anyways, thanks for the help!  It helped me find my solution.

  • 03-06-2009 03:48 AM In reply to

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    Forms with code can be used with IPFS, but I believe the code has to be C# or VB (and both in the 2007 object model), and publishing with code requires administrator approval.

     What kind of stuff is the code in your form doing?

     

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 03-06-2009 03:55 AM In reply to

    • drake
    • Not Ranked
      Female
    • Joined on 02-27-2009
    • Minneapolis
    • Posts 22

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    I saw once I stripped the jscript code and changed the compatibility, that C# and VB were options, but if I select either it tells me that programming can't be used.  Unfortunetly I have no control over the IPFS, but I sent off an email to the admins and hopefully they can help me.

    I'm just using "Add" and "Delete" buttons with code so far to add repeating rows and repeating sections.  It looks to be a huge pain in the butt to do the same thing with C# then it is with jscript.

  • 03-06-2009 04:03 AM In reply to

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    I really don't think it's any more difficult to do those operations with C# as compared to JScript.  If you put your code up here I can show you the C# equivalent.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 03-06-2009 04:08 AM In reply to

    • drake
    • Not Ranked
      Female
    • Joined on 02-27-2009
    • Minneapolis
    • Posts 22

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    //Add a row to the Device Add table.
    function Device_Add_Table::OnClick(eventObj)
    {
        XDocument.View.ExecuteAction("xCollection::insert", "DeviceAddTable_888");
    }


    //Delete a row in the Device Add table.
    function Del_Row::OnClick(eventObj)
    {
        var thisNode = eventObj.Source.selectSingleNode(".");
        thisNode.parentNode.removeChild(thisNode);
    }
  • 03-06-2009 06:31 AM In reply to

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

    Deleting rows is plenty easy in C#:

    public void CTRL7_5_Clicked(object sender, ClickedEventArgs e)
    {
        e.Source.DeleteSelf();
    }

    Since you're going for a browser-enabled form you can't make use of the handy ExecuteAction function, so this is probably the easiest alternative way to add rows:

    1. Save your form template as its source files.
    2. Open up the template.xml file in a text editor and copy the part that corresponds to the repeating group in your form into code so it looks something like the following:
    XPathNavigator groupParent = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:group1", NamespaceManager);
    groupParent.AppendChild(
    "<my:group2><my:field1></my:field1><my:field2></my:field2><my:field3></my:field3></my:group2>");

     The first underlined part is the path to the parent of the repeating group, and the second part is the copied XML (with spaces and newlines deleted).

    Note I would advise against taking this approach when you don't need to, as using ExecuteAction or qRules is better overall when those options are available.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 03-09-2009 08:23 AM In reply to

    • drake
    • Not Ranked
      Female
    • Joined on 02-27-2009
    • Minneapolis
    • Posts 22

    Re: Create a Repeating Table based on whether another repeating table entry is not blank

     You ROCK!  Luckily I don't have to worry about it anymore.  I found a work around.

    Thanks!!

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