Adding data to a xml group - InfoPath Dev
in

InfoPath Dev

Adding data to a xml group

Last post 05-08-2006 07:28 AM by Matt Faus. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 05-04-2006 06:27 PM

    • StephenM
    • Not Ranked
    • Joined on 02-17-2006
    • Australia
    • Posts 10

    Adding data to a xml group

    People

    I am trying to progamatically populate data in an xml group.

    For eg I have a textbox that people would type data in and then click a button which will add the data to a field in a repeating section.

    Im trying to do it in VBscript.

    Any help cheers
  • 05-04-2006 10:41 PM In reply to

    • uma
    • Top 500 Contributor
    • Joined on 12-23-2005
    • Posts 35

    Re: Adding data to a xml group

    Hi,

    Here is the code for which you want execute your example of sample using vbscript.

    But you have to include this code in the onclick event of the button for which you want handile.

    Dim temp
    temp=XDocument.DOM.selectSingleNode("/my:myFields/my:field1").text
    XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2/my:field2").text=temp
  • 05-04-2006 10:52 PM In reply to

    • StephenM
    • Not Ranked
    • Joined on 02-17-2006
    • Australia
    • Posts 10

    Re: Adding data to a xml group

    I had that but it only allowed me to add one entry as it just overworte the previous. I want the user to add as many as they like to the group. I didnt explain it very well.
  • 05-05-2006 04:16 AM In reply to

    Re: Adding data to a xml group

    Hi,

    From the above conversation i uderstood is that,

    you have text box,
    repeating section with field,
    Entered text in text box is displayed in a field in repeating section,

    what iam thinking is that you are not appending section in onclick button,
    thats why entered text in text box overwriting with previous one,

    I have one suggestion is , take field as repeating table,
    create new node and append it sending entered data in text box,

    I think this will help you,

    Thanks.

    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 05-06-2006 04:40 PM In reply to

    • StephenM
    • Not Ranked
    • Joined on 02-17-2006
    • Australia
    • Posts 10

    Re: Adding data to a xml group

    Thats what I want to know how to do how do I Append a new node?

    Cheers
  • 05-07-2006 01:18 AM In reply to

    Re: Adding data to a xml group

    Try this:


    Dim temp
    temp = XDocument.DOM.selectSingleNode("/my:myFields/my:field1").text

    Dim sampleNode = XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2")

    Dim newNode = sampleNode.cloneNode(true)
    newNode.selectSingleNode("my:field2").text = temp

    sampleNode.parentNode.appendChild( newNode )

    PS - I don't normally do VBScript so hopefully the syntax is cohesive.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 05-07-2006 09:53 PM In reply to

    • StephenM
    • Not Ranked
    • Joined on 02-17-2006
    • Australia
    • Posts 10

    Re: Adding data to a xml group

    Ta heaps works a treat.

    This is a handy little tip cheers.
  • 05-08-2006 07:28 AM In reply to

    Re: Adding data to a xml group

    Glad I could help!

    And thanks for the compliment, I don't think I've ever been told "ta heaps works a treat", ha!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.