Repeating table inside repeating section and Qrules insert command. - InfoPath Dev
in

InfoPath Dev

Repeating table inside repeating section and Qrules insert command.

Last post 10-25-2011 11:24 AM by shniggens. 26 replies.
Page 1 of 2 (27 items) 1 2 Next >
Sort Posts: Previous Next
  • 10-21-2011 03:37 PM

    Repeating table inside repeating section and Qrules insert command.

    I have a repeating table that lives inside a repeating section.  I have a button that uses the qrules insert command to add a row to the repeating table.

    However, when a second instance of the repeating section is added, when I click the "add" button, it inserts the row on the table inside the first section only. 

    Is there a way to fix this? 

  • 10-21-2011 03:59 PM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    What version of qRules? What is your command syntax?

    Hilary Stoupa

  • 10-21-2011 06:41 PM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    I'm using QRules 3.3

    Standard Insert command - Insert /parent=/my:myFields/my:Rooming/my:HotelGroup/my:HotelRepeatingSection/my:RoomingGroup /child=my:RoomingTable

     

    I assume I need to filter somehow? 

  • 10-24-2011 08:20 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    There's an alternate syntax if you want to add a filter - xpathsrc.

    So, your command would be something like:

    Insert /parent=/my:myFields/my:Rooming/my:HotelGroup/my:HotelRepeatingSection[2]/my:RoomingGroup /xpathsrc=/my:myFields/my:Rooming/my:HotelGroup/my:HotelRepeatingSection/my:RoomingGroup/my:RoomingTable

    You can use a concat formula to create the /parent XPath, in order to indicate where the insert needs to occur.

     

    Hilary Stoupa

  • 10-24-2011 08:29 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    That works great for the second section.  But what about the 3rd, 4th, etc?  Can the current() function be inserted in here somewhere? 

    I may just have to use the built in Infopath add and remove controls on this repeating table. 

  • 10-24-2011 08:33 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    As I said, you can use the concat function to indicate which of the repeating parent groups should have this inserted. If this is a client form, you could use the position function. If this a browser form, you could use a count of preceding-siblings (this is assuming that the rule to insert the child repeating group is on the parent).

    Hilary Stoupa

  • 10-24-2011 08:58 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    I get it.  Here's what worked for me -

     

    concat("Insert /parent=/my:myFields/my:Rooming/my:HotelGroup/my:HotelRepeatingSection[", count(preceding-sibling::HotelRepeatingSection) + 1, "]/my:RoomingGroup /xpathsrc=/my:myFields/my:Rooming/my:HotelGroup/my:HotelRepeatingSection/my:RoomingGroup/my:RoomingTable")

     

    Now (and I'm trying to be self-sufficient here, but . . . ) how do I accomplish the same with a remove button that resides within the repeating table (Rooming Table)?  Here' what I have in there now -

    concat("Delete /xpath=my:myFields/my:Rooming/my:HotelGroup/my:HotelRepeatingSection/my:RoomingGroup/my:RoomingTable[", count(preceding-sibling::RoomingTable) + 1, "]")

    It removes the last row of every instance of the repeating table (within every instance of the HotelRepeatingSection)

  • 10-24-2011 09:02 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    I think you'd need to specify your HotelRepeatingSection as well - have you tried that?

    Hilary Stoupa

  • 10-24-2011 09:06 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    I'm trying it now, just not sure where to insert it into the formula.  Keep in mind this button resides within the RoomingTable.  So whenever I try to count - I get this error - "preceding-sibling::myHotelRepeatingSection" does not point to a valid location path of a field or group.

  • 10-24-2011 09:23 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    Yes - you'll need to move back up the tree - you are on RoomingTable, so it would be something like ../../preceding-sibling::my:HotelRepeatingSection for the XPath in your count formula (may be one more ../ in there)

    Hilary Stoupa

  • 10-24-2011 09:30 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    Aha!  Yes, you're correct.  Any ideas on how I sneak that second filter in there?  I tried this, and it didn't work -

    concat("Delete /xpath=my:myFields/my:Rooming/my:HotelGroup/my:HotelRepeatingSection/my:RoomingGroup/my:RoomingTable[", count(preceding-sibling::RoomingTable) + 1, count(preceding-sibling::HotelRepeatingSection) + 1, "]")

  • 10-24-2011 09:34 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    concat("Delete /xpath=my:myFields/my:Rooming/my:HotelGroup/my:HotelRepeatingSection[", count(preceding-sibling::HotelRepeatingSection) + 1, "]/my:RoomingGroup/my:RoomingTable[", count(preceding-sibling::RoomingTable) + 1, "]")

    Hilary Stoupa

  • 10-24-2011 09:58 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    Yes, Hilary, that's perfect!!!  Thanks!!!!

    One more question, as I like to milk everybit of information out of every thread I start ......

    Do you know how I could filter a drop-down list box so that it does not contain data from the previously occurring repeating table?   So in a RoomingTable that is in the second occurrance of the HotelRepeatingSection, I want to filter out everything that was already chosen in the first occurrance?

  • 10-24-2011 10:03 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    You can probably do this using a filter with preceding-sibling again ... the filter would be on your drop down list entries, checking to see if the preceding sibling Rooming Table nodes have the value - but I'm not sure off-hand if you'd also need to check based on the Hotel group - you'll have to experiment a bit....

    Hilary Stoupa

  • 10-24-2011 10:12 AM In reply to

    Re: Repeating table inside repeating section and Qrules insert command.

    Yes, I guess I will have to filter on the HotelRepeatingSection, too.  I already have the table filtered to not show previous values in the current table.  But when I add a second instance of the table, the values are all there again.

    So right now the table has -

     

    not(my:MasterLaborPerson = current()/following-sibling::my:RoomingTable/my:Occupant1) and

    not(my:MasterLaborPerson = current()/preceding-sibling::my:RoomingTable/my:Occupant1)

    How do I include the HotelRepeatingSection into this?

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