Using a button to insert data to a repeating table - InfoPath Dev
in

InfoPath Dev

Using a button to insert data to a repeating table

Last post 08-18-2005 12:30 PM by chiablo. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-18-2005 09:29 AM

    Using a button to insert data to a repeating table

    Just some background... The purpose of my form is to act as a problem report that can be passed around to different people in my company. I have a feedback section where someone can add feedback to the form before moving it onto the next person.

    With our current outlook form, we've had problems with people modifying feedback that they've inserted before... this is a problem and causes alot of arguments.

    I've created a button in Infopath that pulls the username and time/date and attaches it to the feedback. If the username field is populated, the feedback becomes read only. I'm quite proud of this implimentation and it will work brilliantly... BUT I'm having problems getting the username to populate correctly.

    In order to get the username in, I'm using C# (it's the only way.) Below is my code:
    IXMLDOMNode nodeName =
    thisXDocument.DOM.selectSingleNode("/my:SHPR/my:Feedback_option/my:Feedback/my:Feedback_repeat/my:Name");
    nodeName.text = System.Environment.UserName; thisXDocument.DOM.selectSingleNode("/my:SHPR/my:Feedback_option/my:Feedback/my:Feedback_repeat/my:Timestamp").text = System.DateTime.Now.ToLocalTime().ToString();


    So what it's doing is pulling the username and putting it into the repeating feedback table into the name field. The same with the date and time.

    I type in the feedback, click the button and it works. But if I add another feedback field (because it's a repeating table) only the first field changes. I can't get the first field to lock and have the button apply to the subsequent fields.

    If further information is needed, I can supply screenshots to better describe what's happening.
  • 08-18-2005 12:10 PM In reply to

    Re: Using a button to insert data to a repeating table

    Hi chiablo,
    My understanding is you always want to set values to the last row of your repeating table. If that is correct then your xpath needs to change accordingly,

    your xpath should be
    "my:SHPR/my:Feedback_option/my:Feedback/my:Feedback_repeat[last()]/my:Name", this will get the last row of your repeating table.
    Similarly your other xpath should also change to get the last row.

    Hope this Helps!

    Agni
    InfoPath Dev India
  • 08-18-2005 12:30 PM In reply to

    Re: Using a button to insert data to a repeating table

    You are a genius... thank you so much!

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