Qrules SetValue copy fields of repeating table to new table with different layout - InfoPath Dev
in

InfoPath Dev

Qrules SetValue copy fields of repeating table to new table with different layout

Last post 08-06-2012 11:20 AM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 08-06-2012 09:17 AM

    • ConJam
    • Not Ranked
    • Joined on 08-06-2012
    • Posts 3

    Qrules SetValue copy fields of repeating table to new table with different layout

    I have a requirement to copy data from a repeating table to another repeating table with a different structure.  The source table is populated via a web service that I can't change and the structure prevents me using the CopyTable command (see attachment).

    Therefore what I'm trying to do is map specified fields from my source to specified fields in my destination: i.e.

     /my:myFields/my:group1/my:group2/my:ItemNo               to               /my:myFields/my:group3/my:group4/my:ItemNo1

     I have the following actions set on a button:

    concat("Insert /parent=/my:myFields/my:group3 /child=my:group4 /count=", count(ItemNo))

    concat("SetValue /xpath=/my:myFields/my:group3/my:group4/my:ItemNo1 /value=", ItemNo)

    This successfully returns the first item but puts this in every row and I'm struggling to find the correct syntax for it to return all values correctly.  If anyone has any ideas it would be very much appreciated.

    (InfoPath 2010 browser form)


  • 08-06-2012 09:32 AM In reply to

    Re: Qrules SetValue copy fields of repeating table to new table with different layout

    You'll want to set the rule to set ItemNo1 on the group4 group, so it executes when the new node is inserted.

    You won't need to use set value, just "Set a field's value", select ItemNo1. Set the value to a formula that uses preceding-sibling to get the correct instance of ItemNo - like:

    /my:myFields/my:group1/my:group2[count(current()/preceding-sibling::my:group4) + 1]/my:ItemNo

    Hilary Stoupa

  • 08-06-2012 10:06 AM In reply to

    • ConJam
    • Not Ranked
    • Joined on 08-06-2012
    • Posts 3

    Re: Qrules SetValue copy fields of repeating table to new table with different layout

    Thanks for the quick responce.  I'm being a complete noob here but getting the attached error. 

    Much Appreciated.


  • 08-06-2012 10:12 AM In reply to

    Re: Qrules SetValue copy fields of repeating table to new table with different layout

    You are setting the rule on group4?

    Hilary Stoupa

  • 08-06-2012 11:12 AM In reply to

    • ConJam
    • Not Ranked
    • Joined on 08-06-2012
    • Posts 3

    Re: Qrules SetValue copy fields of repeating table to new table with different layout

    Great spot.  Now resolved.  What has taken me days of research has taken you a few minutes to simplify and fix. 

    Very much appreciated.

  • 08-06-2012 11:20 AM In reply to

    Re: Qrules SetValue copy fields of repeating table to new table with different layout

    I'm glad you have things working! Enjoy qRules - I'm a bit biased here, but I think it is an amazing product. You'll be able to do all kinds of things you couldn't do before in InfoPath. :-)

    Hilary Stoupa

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