Update a form field with linked data source info from a multi-select field - InfoPath Dev
in

InfoPath Dev

Update a form field with linked data source info from a multi-select field

Last post 03-04-2011 11:37 AM by troywilfred. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 03-04-2011 11:37 AM

    Update a form field with linked data source info from a multi-select field

    So I'm driving myself crazy with a problem I can't seem to find solutions for:

    I have a  multi-select list box (Teams_Impacted) that gets data from a sharepoint list (Business Units).  After I have selected the Business Unit names (BUName), I want to update a text field (Approvals) with the selected BUNames and associated data in for each BUName (Project Officer or PO).  I wanted to use  msoxd_my_Teams_Impacted_OnAfterChange(eventObj) but it did not fire so I used XDocument_OnContextChange(eventObj) ... See below for code

    '***begin code 

    Sub XDocument_OnContextChange(eventObj)

      If eventobj.context.nodename <> "BUName" then

        strHold = ""

        On Error Resume Next

        set objNodes = XDocument.DOM.selectNodes("/my:myFields/my:Team_Impact_List/my:Teams_Impacted")

        For each node in objNodes

          If node.text <> "" then

          set objBUNode = XDocument.GetDOM("Business Units").selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:Business_Units/@PO[../@BUName = '" & node.Text &"']")

          If err.number <> 0 then

             XDocument.UI.Alert("Error in PO Get" & " Error " & err.description)

             err.Clear

          End if

          strNew = node.Text & objBUnode.Text

          If err.number <> 0 then

             xDocument.UI.Alert("Error in concat" & " Error " & err.description)

             err.Clear

          End if

          strHold = strHold & strNew & " "

        End if

      Next

      set objNodes = XDocument.DOM.selectSingleNode("/my:myFields/my:Approvals")

      If strHold = "" then

         strHold = "None"

         objNodes.Text = strHold 

      End if 

    End Sub 

    '***end code

    The line ->set objBUNode = XDocument.GetDOM("Business Units").selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:Business_Units/@PO[../@BUName = '" & node.Text &"']") <- does not return the PO field node of the current BUName in the loop. 

    Please help?

    Troy

     

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