Code or Qrules? - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Code or Qrules?

Last post 03-05-2015 07:47 AM by Hilary Stoupa. 29 replies.
Page 1 of 2 (30 items) 1 2 Next >
Sort Posts: Previous Next
  • 02-02-2015 10:00 AM

    Code or Qrules?

    It's a little too much to put in the title, but I am trying to determine the best way to approach my newest challenge. I am hoping you can direct me to the best path.

    Here is what I have and what I need to do with it.


    1. List with Regions and countries assigned to those regions
    2. Infopath Form


    1. 2 multi-selection sections (must be dynamically populated from a SharePoint list and all must display on the form, no dropdowns)
    a: Regions
    b: Countries

    2. User must be able to select a region or multiple regions, individual countries or a combination of both
    3. When a region is selected countries assigned to that region need to be automatically selected in the regions section
    4. After selecting a region and having the associated countries automatically selected, user must be able to deselect a country in the countries section, which in turn will deselect the region but not affect the other selected countries

    Here is a screenshot of what they want it to look like:

  • 02-02-2015 10:19 AM In reply to

    Is this a browser or a filler form? I had another qRules user where we tried using an Insert command and some form logic to do something similar, but she ran into trouble in the browser (form worked as anticipated in preview / filler).

    Hilary Stoupa

  • 02-02-2015 10:28 AM In reply to

    And here I thought I was doing so good and giving all the information and I left out a critical piece! It is indeed a browser form.
  • 02-02-2015 10:44 AM In reply to

    You did a great job with the details. I looked back through my email - the other time I tried this via qRules in a browser form, my approach of using "insert" and setting values did not work in the browser, and I never had a chance to try to figure out why. Any chance you can use a repeating group with a checkbox control to mimic a multiselect? That would get around the browser issue.

    Hilary Stoupa

  • 02-02-2015 10:48 AM In reply to

    I had thought about that which is what actually triggered my post. I wasn't able to find any topic that referenced dynamically creating the repeating group/table on form load based on the entries in the list. I thought that it should be something I could do with Qrules, but wanted to get the expert opinion.

    I am open to try whatever will work.
  • 02-02-2015 02:29 PM In reply to

    I'd start by putting rules on the Qdabra Rules finishedLoading node - if that is "true", run your rules - that way you know the code is completely loaded.

    Then you can count the number items you need inserted by counting rows in your secondary data source and insert those into your main data source. I'll see if I can find a copy of my sample form that didn't work in the browser (because it used a multiselect) - it should give you some general ideas.

    Hilary Stoupa

  • 02-03-2015 08:10 AM In reply to

     Thanks, that would be extremely helpful as I am not sure what I would be inserting.   A repeating section with a check box or a repeating table with check boxes?    An example would be really helpful.

  • 02-03-2015 12:00 PM In reply to

    Sorry - I haven't been able to track down my sample w/ the multiselect yet. But what I would do is:

    1. Use a repeating section w/ 2 controls in it - a checkbox and a calculated value
    2. Use qRules to insert the right number of these based on the number of items in your list
    3. Use form rules on the repeating group to set the value of the field that will have the name of the item to the value from the list
    4. Use form rules to set all to selected

    I should have time tomorrow afternoon to put together a sample. :)

    Hilary Stoupa

  • 02-03-2015 12:10 PM In reply to

    Thank you so much. I am hoping that in doing this I can get it to lay out in columns because in a columnar format would make the form too long. The example I included in the first post is the actual list of countries that need to be displayed.

    And that sentence made about as much sense as anything I have heard today. I actually meant to say I would like it to appear in a multi-column layout because a single column would be too long.
  • 02-04-2015 03:33 PM In reply to

    Check this sample, just save locally, right click and select Design, then preview.

    Hilary Stoupa

  • 02-09-2015 01:02 PM In reply to

    I did this and have set it up but I am getting my values for the repeating section from a Sharepoint list. So far I am not having any luck with it adding the sections. There is no error in the error node either. So at the end of the string concat("Insert /parent=/my:myFields/my:group1 /child=my:group2 /count=", count(state)) where you are getting the 'state' from the xml value, I have tried both the SharePointListItem_RW and the Country field and no luck with either. It also looks like I need to modify some rules on the repeating sections to reference the data connection. Can you tell me how I need to modify those to reference a list data connection?

    Can you tell me what I should be selecting here?

  • 02-09-2015 02:10 PM In reply to

    You want the count of the SharePointListItem_RW. When do you query that data source?

    Hilary Stoupa

  • 02-10-2015 04:18 AM In reply to

    I am querying the data source on form load. Also, is there anything I need to change about this formatting rule that is on the sections to make it work with a list data connection? count(current()/preceding-sibling::my:group2) > count(xdXDocument:GetDOM("States")/states/state) div 3
  • 02-10-2015 06:59 AM In reply to

    You would enter the XPath to the repeating group for the list to replace this: xdXDocument:GetDOM("States")/states/state

    So - probably: xdXDocument:GetDOM("Market Country")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW

    Hilary Stoupa

  • 02-11-2015 11:59 AM In reply to

    You would think that this would be easier than this, but I am now getting an error on the set name rule that is on the repeating section.

    Here is what I have for the 'set a fields value'. It's setting the strCountryName value to d:SharePointListItem_RW[count(current()/preceding-sibling::grpMarketCountry) + 1]/@Country

    It's giving me the error that /preceding-sibling::grpMarketCountry isn't a valid path to a field or group.

    Here are my two data sources

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