Cascading DropDowns and Multiple Datasources - InfoPath Dev
in

InfoPath Dev

Cascading DropDowns and Multiple Datasources

Last post 11-24-2008 06:35 AM by booyaa. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-04-2008 02:39 PM

    • booyaa
    • Not Ranked
    • Joined on 11-04-2008
    • Posts 4

    Cascading DropDowns and Multiple Datasources

    Greetings, I am currently developing an InfoPath template, I am a Jr. Developer and have great minds around me in the developing area but they have absolute no experience with the development of InfoPath. The issue involves multiple datasources and cascading dropdowns, I am upgrading our current template from Office 2003 to Office 2007. The current template is using the taskpane for a few of our dropdown lists. Due to security restrictions in Vista & IE we are having to get rid of expression boxes & button that generate info per previous dropdowns into the taskpane, but mainly getting rid of the Taskpane all together. So that is a summary and here is my issue, any suggestions would be great. I currently have 3 DropDown boxes and 4 data sources (all XML files). 1) Country (Country.xml) 2) State (State.xml) 3) Area (USArea.xml & NONUSArea.xml) You select the country, if you choose "US" then the State dropdown is generated with "US states", if you select any country beside "US" then the Area dropdown is generated upon the NON-US Area list and the state dropdown is greyed out. Now I have the state list greyed out based on rules, works great. However I am not able to distingush which data source to use for the Area dropdown because in the options I am only allowed to select 1 datasource. I can not combine these XML Data sources. I have attempted to setup rules and data validation but haven't been able to work it out. I would have thought that based on certain set of rules I would be able to query a alternate datasource, but have had no success. If anyone has any suggestions, links to tuts or anything along those lines please post back and let me know. Thanks!
  • 11-04-2008 10:11 PM In reply to

    Re: Cascading DropDowns and Multiple Datasources

    Hi,

    I think you can implement your functionality by taking two drop downs, one drop down is binded to the "US Areas" secondary datasource and another one is pointing to the "Non US Areas" Secondary datasource. Please follow the below steps.

    ·         Add two drop down into the UI with a sections.

    ·         The above two drop downs is binded to the same field in the Main data source.

    ·         Bind the two drop downs into the two different secondary data source(i.e., US and NON-US).

    ·         Apply conditional formatting for each section(in which Area drop downs exist) for hiding the sections depending upon the Country (i.e., US and Non US).

    I hope the above steps will help you.

    Chandrakanth/GGKTech
  • 11-06-2008 10:38 PM In reply to

    Re: Cascading DropDowns and Multiple Datasources

    Hi Booyaa,

     

     Welcome to our forum!

     

    I found some helpful links for you, which might be similar to your case:

     

    http://www.infopathdev.com/forums/p/7355/26891.aspx#26891

     

    http://www.infopathdev.com/blogs/greg/archive/2005/07/14/Create-a-Repeating-Cascading-List-from-a-Flat-Data-Source.aspx

     

    Thanks,

    Jo-Anne Alfafara
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
  • 11-10-2008 06:34 AM In reply to

    • booyaa
    • Not Ranked
    • Joined on 11-04-2008
    • Posts 4

    Re: Cascading DropDowns and Multiple Datasources

    Thank you all for the replies. I've tried some of the steps from above but they have not been the answer we're looking for (or even a work around for that matter). Can anyone confirm that dropdowns can not be called directly from the backend, but only through a changed/changing/validating event? We're trying to call a certain dropdown control but had read an article on MSDN informing us that a dropdown can not be called from the backend. It seems that regardless of the code we write, the performance on the lookup of our Foreign List is too great and at times locks up till it brings back a result. We've even tried filtering based on the XML Datasource. Maybe we're trying to accomplish something that is just impossible to accomplish, I'm not totally sure just yet but I refuse to throw in the towel. Thanks again for all your help and suggestions.
  • 11-10-2008 07:34 AM In reply to

    Re: Cascading DropDowns and Multiple Datasources

    That's correct.  You cannot directly access an InfoPath form's controls via code.  You can only modify the nodes to which they are bound, and you cannot change the binding at runtime either.

     The only alternative if you want to have complete control over a dropdown's contents is to bind it to an intermediary node somewhere and populate that via code as you see fit, but from what I understand of your original post, Chandra's suggested soution (use two dropdowns and conditional formatting to hide either one) would be the typical way to go about it.

     We could probably be a bit more helpful if you would give a bit more detail about what exacty you are trying to do.  I'm having trouble guessing why the form would lock up from accessing an XML file that just contains a list of areas.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-10-2008 08:12 AM In reply to

    • booyaa
    • Not Ranked
    • Joined on 11-04-2008
    • Posts 4

    Re: Cascading DropDowns and Multiple Datasources

    Thanks Jimmy for the reply. I'll try to explain a bit better. To me its very complex but to others they may see it other ways.

    I have a Country DropDown. In the Country DD it has an XML datasource containing all of the countries. The Country datasource has the country listed and a code of the country (ie: United States code would be US).

    Below the Country DD is a State DD, which is driven off of a US State list xml datasource. If you choose "United States" in the Country DD then the State DD is enabled and you can choose a State. If a Foreign Country is selected then the State DD is hidden and only 1 Area DD is listed below (which in that case would be a Foreign Area listing).

    There are 2 Area DD's, 1) For Foreign Areas 2) For Local State Areas. Each drop down has its own XML datasource and filtered on results based on the Country code generated from the above DD. The difference in the 2 Area XML datasources is that the XML structure is different, different values. The other difference is the size, the Foreign Area listing is 1,297KB while the State Area listing is only 105kb.

    However in our schema for generating the XML the Area DD's share the same fields, you only have the option of having Foreign Area or State Area but their values go in the same field after the XML is generated.

    The issue again is that the Foreign Area listing can take forever to load and at times lock up until result is brought back while the State Area listing is instant. Also unable to reference a forms controls is another area we are having difficulty with, writing the unique value from either one of the controls (state or foreign) to the designated field in the XML.

    Again I'm jr. level developer, the InfoPath is an entirely new beast to me. I'm very happy to be learning it but coming across some very difficult situations to achieve what we're trying to achieve (I understand nobody ever said it would be easy and I certainly didn't expect it to be).

    Any help or suggestions would be great, again sorry if I'm not being totally clear I'm sometimes at a loss for words on how to describe the issue we're experiencing.
  • 11-24-2008 06:35 AM In reply to

    • booyaa
    • Not Ranked
    • Joined on 11-04-2008
    • Posts 4

    Re: Cascading DropDowns and Multiple Datasources

    Thanks to everyone for their help and advice in this matter. We have solved the issue we were running into. Jimmy, your latest post kind of put us in the right direction but it was a lot of working around the schema and the dropdowns and bringing values back n forth between the multiple DD's to determine what to generate and then what to save. I'm still sort of lost as to how we accomplished it but the more I work with it the better I'll be off. Thanks again to everyone who helped, now off to my latest issue (attaching a PDF inside the template and then linking it within the template)
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.