Repeating Table - Update to field should update same field on other rows - InfoPath Dev
in

InfoPath Dev

Repeating Table - Update to field should update same field on other rows

Last post 05-02-2017 09:07 AM by GwenW. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 04-19-2017 08:35 AM

    Repeating Table - Update to field should update same field on other rows

    Hi, I have a InfoPath 2010 (SharePoint 2010) browser form, and am trying to figure out the best way to pass data in a repeating table. I'm attaching screenshots to help explain.

    Here's background.....This repeating section is from a secondary data source (SharePoint list) that is queried on the previous view. Changes to the data are pushed to a temporary (hidden) table where they are bulk submitted to SharePoint using qrules - submit to sharepoint command. 

    In each screenshot, I show 4 rows of data from the repeating table (some fields are shown conditionally based on other fields). The original query pulls up the 1st screenshot.  The top row has an expense/revenue category of "Expense - Other Labor". This is also captured in the other rows in the yellow fields. If the user changes the first row's Revenue/Expense Category (see 2nd screenshot), then I need the yellow fields on rows 2-4 to update to the same value. So, in this case I need rows 2-4 to not show "Expense - Other Labor", but instead they need to update to "Expense - Freight".

    The added requirement is that these yellow fields only update while the GL Account Range matches the value in Row 1 (there could be other ranges further down in the data, it's just not shown here).  

    I think I can do this in a workflow after the data is submitted, but I am looking for something quicker to be in InfoPath prior to the data being submitted.  I'm playing with preceding sibling (which I have only used once for a different situation), but I can't figure out how to get it to work (can it even be done in a secondary data source?).  Is this the way to go (and if so, any pointers?) or is there something else I should do?

     

    Thanks!

    Gwen

     

     

     

     


  • 04-19-2017 08:36 AM In reply to

    Re: Repeating Table - Update to field should update same field on other rows

    Everything I'm finding in my research doesn't show preceding sibling with a secondary data source. It looks like you would use it in a default value on the field, which can't be done on a secondary data source. Is that correct?  Any suggestions on what to use?  

  • 04-24-2017 07:25 AM In reply to

    Re: Repeating Table - Update to field should update same field on other rows

    I made a simplified example of what I'm trying to accomplish - see the below screenshot.  This is a secondary data source (similar to how my real one is setup) in a repeating section, Main Color is a dropdown field that the user can change. So, if a user changes the Main Color for the Horse - Main entry (C2), then I need the Horse - Sub - Main Color entries (C3, and C4) to update with the same value. 

    With it being a secondary data source, I can't set default values. I'm just trying to figure out how to accomplish this... I've researched preceding/following sibling and even tried current()/last() type functions conditionally and can't figure out if these are the ways to go. Just need a point in the right direction :)

     

    thanks! 


  • 04-25-2017 11:10 AM In reply to

    Re: Repeating Table - Update to field should update same field on other rows

     Hey, Gwen, sorry I missed these posts. You could use qRules SetValue for this - your command would be a formula like (obviously I've got some placeholders in here!):

    concat("SetValue /dsname=SECONDARYDATASOURCENAME /xpath=XPathToYourField[FilterField = '", SelectMainDSField,"'] /value=", FieldWithValue)

    What you are trying to do is set the /xpath param in the SetValue command to the 2ds field you wish to set, with a filter, like: /dfs:group/d:field[../d:otherfield = 'Horse']

    EDITED to add the /value param which I forgot the first time - sorry! :) 

    Hilary Stoupa

  • 04-28-2017 09:36 AM In reply to

    Re: Repeating Table - Update to field should update same field on other rows

    Hi Hilary, that worked perfectly. Now I've run into another block. I'm adding to this thread so I can use the same example, but I can start a new one if needed...

    I have a view where we allow the user to add a new sub record. For instance Add a row #11 - Cat | Sub | blank {main color} | Purple (sub color)  

    The problem is that I need to somehow get the Main Color for Cat into the record. The only thing I can come up with is after the Submit to SharePoint to create the record, then query the list again (filter of Cat/Main) to find the main color, then run a second map to update the newly created record with the main color.  (hope that makes sense :) ).

    Is this the route to go, or can you think of an easier solution? 

    Thanks!

    Gwen 

     

  • 04-28-2017 10:32 AM In reply to

    Re: Repeating Table - Update to field should update same field on other rows

    How do they add the subrecord? You have an insert button, or they use the InfoPath widget?
    Hilary Stoupa

  • 04-28-2017 10:44 AM In reply to

    Re: Repeating Table - Update to field should update same field on other rows

    There is a button with a SubmitToSharePointList command and a map for the sub fields.

  • 05-02-2017 09:07 AM In reply to

    Re: Repeating Table - Update to field should update same field on other rows

    In case anyone is trying something similar... I added a rule on my button  (to fire before the rules that are the main purpose of the button) where it queries the main dataset for the main records to pull in the data that I need. I then pass those values into InfoPath fields (set default values) in order to hold the values until the user inputs the remaining data and my map runs to submit the entire set of data to SharePoint.

    Thanks for all the help! 

     

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