Populate Multi Drop Down boxes with SharePoint List Data - InfoPath Dev
in

InfoPath Dev

Populate Multi Drop Down boxes with SharePoint List Data

Last post 08-10-2009 07:38 AM by Irianna. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-10-2009 06:36 AM

    Populate Multi Drop Down boxes with SharePoint List Data

    Hi Folks,

    Was wondering If i could find some help with this -

    I've currently got a SharePoint list, three coloums:

    -Directorate
    -Department
    -Name

    I have a Form, with the same three boxes (drop downs)

    Id like the form to fill the the data from the one List, depending on what the selection was, so when Directorate changes, Department is populated with the information from the list, and then again when the deparment is selected, to populate Name with the Names under that department.

    I can get it working when the i have the Directorate, Department and Names in seperate lists, but cannot seem to get it to work from the one list.

     My Code is (VB.net)

    Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup

                AddHandler EventManager.XmlEvents("/my:myFields/my:Directorate").Changed, AddressOf Directorate_Changed

                AddHandler EventManager.XmlEvents("/my:myFields/my:Department").Changed, AddressOf Department_Changed

            End Sub



            Public Sub Directorate_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)

                Call SetDepartment()

            End Sub

            Private Sub SetDepartment()

                Dim q As FileQueryConnection, OriginalFileLocation As String

                q = CType(Me.DataConnections("Appraisal Progress List"), FileQueryConnection)

                OriginalFileLocation = String.Copy(q.FileLocation)

                Try

                    q.FileLocation = q.FileLocation + "&FilterField1=Department&FilterValue1=" + GetDepValue()

                    q.Execute()

                Finally

                    q.FileLocation = OriginalFileLocation

                End Try

            End Sub



            Private Function GetDepValue() As String

                Dim nav As XPathNavigator, filterValue As String

                nav = Me.CreateNavigator()

                filterValue = nav.SelectSingleNode("/my:myFields/my:Department", Me.NamespaceManager).Value

                GetDepValue = filterValue

            End Function



            Public Sub Department_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)

                Call SetName()

            End Sub

            Private Sub SetName()

                Dim q As FileQueryConnection, OriginalFileLocation As String

                q = CType(Me.DataConnections("Appraisal Progress List"), FileQueryConnection)

                OriginalFileLocation = String.Copy(q.FileLocation)

                Try

                    q.FileLocation = q.FileLocation + "&FilterField1=Name&FilterValue1=" + GetNameValue()

                    q.Execute()

                Finally

                    q.FileLocation = OriginalFileLocation

                End Try

            End Sub



            Private Function GetNameValue() As String

                Dim nav As XPathNavigator, filterValue As String

                nav = Me.CreateNavigator()

                filterValue = nav.SelectSingleNode("/my:myFields/my:Name", Me.NamespaceManager).Value GetNameValue = filterValue End Function



    Any ideas where I'm going wrong with this?

    Many thanks in Advance.

    Irianna

     

    -------
  • 08-10-2009 07:13 AM In reply to

    Re: Populate Multi Drop Down boxes with SharePoint List Data

    If I understand you correctly, I would suggest that an XPath filter on each list might be easier.

    You only have one list so on the first list you show directorate and make it unique by applying this filter:

    not(@Directorate = preceding-sibling::dfs:ListName/@Directorate)

    You make the second list unique and also filter it against the selection for Directorate and similar for the 3rd list.

  • 08-10-2009 07:38 AM In reply to

    Re: Populate Multi Drop Down boxes with SharePoint List Data

    This is going to be a web based form, so not able to apply filters :(

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