repeating section setting values of text boxes - InfoPath Dev
in

InfoPath Dev

repeating section setting values of text boxes

Last post 02-20-2007 01:33 PM by Mario. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-12-2007 02:08 PM

    • Mario
    • Not Ranked
    • Joined on 11-04-2005
    • Posts 15

    repeating section setting values of text boxes

    I am having a problem with some code to set the value of some text boxes in a repeating table for the 2nd, 3rd, 4th, etc. rows. Each time I add a new row, it seems to be updating the 1st row only.

    In the repeating table, I have the 1st column being a drop down. Once the user chooses an item, it goes and grabs the values from a database and populates the text boxes on that row.

    I have some vbscript in the OnChanged event of the drop down, it looks as follows:

    Dim doc
    Set doc = XDocument.DataObjects("UV_Proposal_Process_Maint").DOM

    doc.setProperty _
    "SelectionNamespaces","xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" " & _
    "xmlns:dsf=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" " & _
    "xmlns:q=""http://schemas.microsoft.com/office/infopath/2003/ado/queryFields"" " & _
    "xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-02-02T17:26:37"" " & _
    "xmlns:d=""http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"" "




    selectedProcess=""
    if isnull(eventobj.newvalue) then
    exit sub

    else
    selectedProcess=cstr(eventobj.newvalue) 'this works
    end if


    dim strjunk

    ' Get the selected node
    Dim selectedNode, objSingleNode, objNode2

    set selectednode=nothing
    Set selectedNode =XDocument.GetDOM("UV_Proposal_Process_Maint")


    set objSingleNode=nothing

    'next line works
    Set objSingleNode=selectedNode.selectSingleNode("//d:UV_Proposal_Process_Maint[@ProcessID='" & selectedProcess & "']")

    strjunk=objsinglenode.attributes.getnameditem("Speed").text

    intSpeed=cint(strjunk)
    msgbox ("current speed is ") & strjunk

    set objnode2=nothing
    set objNode2=eventObj.Source.ParentNode.SelectSingleNode("//d:UT_Proposal_Process[@ProcessID='" & selectedProcess & "']")

    objNode2.SelectSingleNode("//dfs:dataFields/d:UT_Proposal/d:UT_Proposal_Process/@Speed").text=strjunk

    End Sub

    In the code above the "selectedProcess" variable is the one in the drop down, then it goes and grabs the speed variable from the database. It appears to be getting the new process and the proper speed in the 2nd and 3rd rows fine (using eventobj.newvalue), but when I change the text box, it always changes the 1st row, not the new processes row.

    Any ideas on what I am doing wrong in setting text box?

    Any help appreciated, thanks much in advance.!!!



  • 02-15-2007 12:12 PM In reply to

    Re: repeating section setting values of text boxes

    Hi Mario,

    I think you should change this line
    objNode2.SelectSingleNode("//dfs:dataFields/d:UT_Proposal/d:UT_Proposal_Process/@Speed").text=strjunk
    to this:
    objNode2.SelectSingleNode("@Speed").text=strjunk

    Hope that works!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 02-20-2007 01:33 PM In reply to

    • Mario
    • Not Ranked
    • Joined on 11-04-2005
    • Posts 15

    Re: repeating section setting values of text boxes

    Matt, your suggested code worked, thanks much for
    taking the time to diagnose and respond.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.