Infopath 2007 Cascading filtered drop downs - InfoPath Dev
in

InfoPath Dev

Infopath 2007 Cascading filtered drop downs

Last post 11-21-2011 01:21 PM by dsk96m. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 11-21-2011 08:27 AM

    Infopath 2007 Cascading filtered drop downs

    I am going out of my mind trying to get this done.  I have searched google and have tried sooooooo many different ways, none of which I can seem to get working.

     I have a 5 levels i need to cascade based on the previous level.  This is a browser enabled form.  I have a sharepoint list that has manager in column 1, employee in column 2.  I also have an xml as well.  This is a manager employee connection but several levels.

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <Manager_Lvl1>
      <manager id="1">Persons Name</manager>
     </Manager_Lvl1>
     <Manager_Lvl2>
      <manager2 manager="1" id="1">Persons Name</manager2>
     </Manager_Lvl2>
     <Manager_Lvl3>
      <manager3 manager2="1" id="1">Persons Name</manager3>
     </Manager_Lvl3>
     <Manager_Lvl4>
      <manager4 manager3="2" id="1">Persons Name</manager4>
     </Manager_Lvl4>
     <Manager_Lvl5>
      <manager5 manager4="62">Persons Name</manager5>
     </Manager_Lvl5>
    </data>

    i have tried using rules, using code, everything.   I can not get this to work.  I swear i have looked at so many ways to do this, just cant get it to work.  Not sure how my data should be laid out.  Here is the thing.  The data for employee manager comes out of a db and I am just uploading it to a sharepoint list.  So i dont need lookups or anything.

    My list looks like this

    manager1    employee1

    manager1    employee2

    manager2    employee3

    manager2     manager3

    manager3    employee4

     

    and so on.  Can anyone PLEASE help.  I am dying here.  Thank you so much in advance.  If you help me get this working i can send you a few bucks or something.

    Thanks

    Dave

     

  • 11-21-2011 11:01 AM In reply to

    Re: Infopath 2007 Cascading filtered drop downs

    Here is my code: for one of the levels

    public void level2_Changed(object sender, XmlEventArgs e)

    {

    XPathNavigator parent = e.Site.SelectSingleNode("..");

    // Remove existing values first

    List<XPathNavigator> nodesToDelete = new List<XPathNavigator>();foreach (XPathNavigator level3SourceNode in parent.Select("my:level3Source", NamespaceManager))

    {

    // Cannot just call DeleteSelf on the navigator because it alters the iteration state.

    // Instead, collect the navigators for future deletion.

    nodesToDelete.Add(level3SourceNode.Clone());

    }

    // Now remove all the nodes.

    foreach (XPathNavigator level3SourceNode in nodesToDelete)

    {

    level3SourceNode.DeleteSelf();

    }

     

    string matchingManager_Lvl3XPath = String.Format("/data/Manager_Lvl3/manager3[@manager2 = '{0}']", e.Site.Value);

    // For each matching city, add it to the collection

    foreach (XPathNavigator manager3Navigator in this.DataSources["Roster"].CreateNavigator().Select(matchingManager_Lvl3XPath))

    {

    using (XmlWriter writer = parent.AppendChild())

    {

    writer.WriteElementString(
    "level3Source", NamespaceManager.LookupNamespace("my"), manager3Navigator.Value);

    }

    }

    }

     

    It works up to writer.WriteElementString("level3Source", NamespaceManager.LookupNamespace("my"), manager3Navigator.Value);

    The correct value is in manager3.navigator.value, but it isnt writing it to level3source.  Please help

  • 11-21-2011 11:56 AM In reply to

    Re: Infopath 2007 Cascading filtered drop downs

    Dave -

    There isn't a way to do this when configuring the properties for the data connection for the drop down but if you add a rule to filter the values based on the value in the previous drop down this is possible.

     Scott

     

  • 11-21-2011 01:21 PM In reply to

    Re: Infopath 2007 Cascading filtered drop downs

    No way to code it, there has to be.  If i can figure out how to pull the info out of the xml, i think i can do it.

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