Repeating table with an additional column - InfoPath Dev
in

InfoPath Dev

Repeating table with an additional column

Last post 03-29-2018 09:21 AM by Patrick L. 17 replies.
Page 1 of 2 (18 items) 1 2 Next >
Sort Posts: Previous Next
  • 03-02-2018 09:49 AM

    Repeating table with an additional column

    Hi,
    Forgive me if this has been answered already... I'm using a SharePoint 2013 list as a data source for a web based IP form. Below is a very simplified description of what I'm trying to achieve.

    SP list "Tools" has the following items:

    Basic Tools
    New Tools
    Cool Tools
    Widgets

    What I'm trying to do is to show all items from the list in a repeating table on the form and I can do that if I use the 'Tools' secondary data source.  So far, so good...

    Now I want to add a checkbox column next to each tool so the user can select one or more items.  Once checked, it will open another repeating table with more choices.

    Basic Tools [x]
    New Tools   [ ]
    Cool Tools   [ ]
    Widgets       [ ]

    Long story short, adding a checkbox column is where I cannot get it to work.  I've tried changing binding of the repeating table, default values of the fields etc. etc. etc.

    Any ideas? 

  • 03-02-2018 04:32 PM In reply to

    Re: Repeating table with an additional column

    So - here's the thing. InfoPath is only going to save data in the main data source. So if you need to save the checked items, you'll have to copy the data into the main data source .... and InfoPath doesn't offer a good way to do that out of the box. And when you say checking something opens another repeating table - I'm guessing you want a certain number of rows in that too, right? From the same secondary data source? Or a different one?
    Hilary Stoupa

  • 03-02-2018 05:35 PM In reply to

    Re: Repeating table with an additional column

    Thx for responding Hilary.

    I know that I can insert a repeating table in the Main data source and use a combobox with its data source connected to a secondary data source (Tools in this case).  Also, once I select a Tool in the combobox I can create a rule that unhides another repeating table with more choices through a combobox (from a different data source). Example: select 'Basic Tools' --> then select from 'Tool A' 'Tool B' etc.

    My problem with the above is that it only displays one row at a time and the user has to click 'New item' to insert a new row. What I'm trying to achieve is NOT to use comboboxes, rather display everything at once where the user just clicks a checkbox.

    So, changing my original question a little - is there a way to display all the items in a repeating table (that uses a secondary source) in the Main data source without resorting to a combobox and clicking 'New item'?

  • 03-05-2018 07:50 AM In reply to

    Re: Repeating table with an additional column

    Adding rows to repeating group requires code (or qRules) or you may be able to use default data if you have an idea of the max number of rows you'll need. InfoPath doesn't have an out of the box way to add rows to a repeating group, which is what you'd need here, right?
    Hilary Stoupa

  • 03-05-2018 10:18 AM In reply to

    Re: Repeating table with an additional column

     I don't want to use code and I can't use any 3rd party apps by policy.

    You are correct that I want to have a repeating group to display everything. How would the max number of rows work in my example?

  • 03-05-2018 10:29 AM In reply to

    Re: Repeating table with an additional column

    Here's a sample with the general concept - If you look under the Defaults on the data tab, you'll see a number of instances of the repeating group are included by default. There is a form load rule that sets a helper field, which then sets values in the main DS from the secondary DS. Save the sample locally, right click and select Design & you can take a look at the rules / defaults / preview / etc. The general idea is that you include by default the max number of the repeating group you'll need, add logic to set values, and hide any rows that are blank.
    Hilary Stoupa

  • 03-05-2018 01:57 PM In reply to

    Re: Repeating table with an additional column

     Thx! I can see how it works and that's what I'm looking for. Of course I cannot get it to work... Any chance you can help?

    I've setup the form load rule and also six group8 under default values.
    Your rule in XPath: xdXDocument:GetDOM("States")/states/state[count(current()/../preceding-sibling::my:group2) + 1]/@abbreviation
    I'm able to create a similar rule until I get to '/@' in the path: xdXDocument:GetDOM("Programs-Tools Request")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title[count(current()/../preceding-sibling::my:group8) + 1]

    Once I add '/@Description' at the end I get an error "xdXDocument:GetDOM("Programs-Tools Request")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title/@Description" does not point to a valid location path of a field or group."  I can see that it points to "Title/@Description" but don't know how to fix it (tried a zillion ways).

    Opening the form without /@... gives me the first item in my list - the other 5 are blank.  Removing /@abbreviation from your rule shows nothing, I guess it's because of hide blank rows.

    If it helps:
    Title is the default value from the list and I renamed to Program/Tool
    Description - description of tool options

  • 03-05-2018 02:32 PM In reply to

    Re: Repeating table with an additional column

    What is the full XPath to the Description field? Right click it in the fields taskpane and select "Copy XPath".
    Hilary Stoupa

  • 03-05-2018 05:37 PM In reply to

    Re: Repeating table with an additional column

     /dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Description

  • 03-06-2018 09:43 AM In reply to

    Re: Repeating table with an additional column

    So, I'd guess you'd need something like: xdXDocument:GetDOM("Programs-Tools Request")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[count(current()/../preceding-sibling::my:group8) + 1]/d:Description
    Hilary Stoupa

  • 03-07-2018 07:44 AM In reply to

    Re: Repeating table with an additional column

     Unfortunately I only get one row of data.  Putting the /d:Description or /d:Title at the end gives the same result as having it before [count(.

  • 03-07-2018 08:06 AM In reply to

    Re: Repeating table with an additional column

    Feel free to attach a copy of your form to a reply under the Options tab & I can take a look at the formula.
    Hilary Stoupa

  • 03-07-2018 10:34 AM In reply to

    Re: Repeating table with an additional column

    Problem solved (one of them).  As I was making a "Reader's Digest" version of the form to post, it suddenly worked as advertised - the Tool Name (Title) shows on every row. The problem was that I originally had created 3 columns in the repeating table: Title, Description, and Select. Then I added the "set" field just as in your example and that field is non-repeating even though it shows on every row. Note to myself - always create all the columns to start, then delete after it's functional.

    On to the next problem (hope you're still with me): Your example does not show any blank rows even though I added more in Default Values. I'm having a hard time replicating that, my form shows 8 rows even though there are only 6 in the SP list.

    Your XPath: xdXDocument:GetDOM("States")/states/state/@name[../@abbreviation = current()/../my:field1]
    My XPath (from my Reader's Digest form): xdXDocument:GetDOM("Programs-Tools Request")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Description[../d:Title = current()/../my:field1]

  • 03-07-2018 10:57 AM In reply to

    Re: Repeating table with an additional column

    There is a formatting rule on the repeating table to hide blank rows. :)
    Hilary Stoupa

  • 03-07-2018 11:22 AM In reply to

    Re: Repeating table with an additional column

     Well, well... what d'ya know... :)

    Thx for all your help! 

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