unable to get the fields value in current row of a changed event in a repeating table - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

unable to get the fields value in current row of a changed event in a repeating table

Last post 08-05-2009 09:16 AM by bella. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 07-31-2009 01:42 PM

    • naresh
    • Not Ranked
    • Joined on 07-22-2009
    • Posts 5

    unable to get the fields value in current row of a changed event in a repeating table

    Hi

     I have a repeating table where I've got a control(radio button) that repeats in every row.I wrote a changed event for that radio button that it would show the current value of that field. The code I'm using is here:

    public void ADD_FLG_Changed(object sender, XmlEventArgs e)

    {

                    XPathNavigator xpath = MainDataSource.CreateNavigator();     

               if (CurrentView.ViewInfo.Name.ToString() == "First_View")

                    {

                    e.Site.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:Z_RFC_PR_CREATE_EX/IT_PRITEMS/item/CHK_VW", NamespaceManager).SetValue(e.Site.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:Z_RFC_PR_CREATE_EX/IT_PRITEMS/item/ADD_FLG", NamespaceManager).Value);

                     string y = e.Site.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:Z_RFC_PR_CREATE_EX/IT_PRITEMS/item/CHK_VW", NamespaceManager).Value.ToString();

                  }

    }

    My problem is: Each and every time when I click radio button, it's not getting the current field value of that particular row. Also, I tried with other options like: in place of the whole xpath, I tried with only repeatingnode/field (item/chk_vw). Even that didn't work. Please help me in getting the current field's value of a current row in a repeating table

    Thanks in advance....

  • 07-31-2009 05:02 PM In reply to

    Re: unable to get the fields value in current row of a changed event in a repeating table

    Please remember that using a full XPath is always wrong when you are trying to target a specific node in a repeating group (unless you want the first node or are using filters in square brackets []).

    In a changed event, e.Site should be positioned at the node to which the event is attached (in this case it looks like it's ADD_FLG).  What happens if you use

    e.Site.Value

    To get the value of ADD_FLG, and

    e.Site.SelectSingleNode("../CHK_VW", NamespaceManager)[+ .Value  /  .SetValue()]

    To get at the CHK_VW node?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-31-2009 05:52 PM In reply to

    • naresh
    • Not Ranked
    • Joined on 07-22-2009
    • Posts 5

    Re: unable to get the fields value in current row of a changed event in a repeating table

    Hi Jimmy,

               Thank You very much its working....It is getting the current row field's value.

  • 07-31-2009 10:18 PM In reply to

    • bella
    • Not Ranked
    • Joined on 07-31-2009
    • Posts 9

    Re: unable to get the fields value in current row of a changed event in a repeating table

    Jimmy,

    I am going to apologize for my newbie question.  I have a similar issue to what was posted by this user but could not follow your response.  I have been self taught on InfoPath and am not familiar with manipulting code. 

    I created a form with a repeating section.  In the repeating section I have a dropdown list called 'DistributionList'.  This dropdown list is populated by a Sharepoint I set up.  The "display value" for the dropdown list is the actual name, and the actual 'value' for that drop down list is the corresponding email address.  Next to this drop down list, I have a 'send email' button, also inside of the repeating section.  The idea is that I can pick 1 name in each repeating section and click the 'send email' button next to the name to send that particular name an email.   The issue I am coming up with is when the 'send email' button is selected in whichever section, it will always want to email the name selected in the very first repeating section.  So if I pick 'bella' in the first section, 'andrew' in the second repeating section, and click the 'send email' button next to 'andrew', the system will want to send the email to 'bella' instead of 'andrew'.

    Can you help?  I was trying to manipulate the formula for the data connection but it doesnt work.  Beyond working with 'Tools > Data Connections > Submit Data > as an email address> 'To' , I wouldnt know where to start with manipulating code to make it pick the right name, but would like to learn if you dont mind helping. 

    thank you for your time.

    bella

  • 07-31-2009 10:54 PM In reply to

    Re: unable to get the fields value in current row of a changed event in a repeating table

     Ciao bella,

     I'd be happy to help you with this.  Could you possibly provide a screenshot of your data source (in the taskpane) so I can see what all the nodes are called, and we'll take it from there.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-04-2009 10:04 AM In reply to

    • naresh
    • Not Ranked
    • Joined on 07-22-2009
    • Posts 5

    Re: unable to get the fields value in current row of a changed event in a repeating table

    Hi Jimmy,

             I tried    e.Site.SelectSingleNode("../CHK_VW", NamespaceManager) [+.SetValue("K")]    to set the value "K" to the above field. It was giving me a syntax error. 

  • 08-04-2009 05:37 PM In reply to

    Re: unable to get the fields value in current row of a changed event in a repeating table

    You shouldn't actually be using the brackets and plus sign.  Those were just there to show you that there were those two possible endings for getting and setting the value.

    e.Site.SelectSingleNode("../CHK_VW", NamespaceManager).SetValue("K");

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-04-2009 09:35 PM In reply to

    • bella
    • Not Ranked
    • Joined on 07-31-2009
    • Posts 9

    Re: unable to get the fields value in current row of a changed event in a repeating table

    Hi again Jimmy... thanks for your offer to help.  I hope this is the image you were looking for.  The repeating section is called 'Reviewers'.  Inside this repeating section I have a section currently called 'group 44' which has the 'reviewername' field with a orange 'send' button next to it.  I would like to be able to hit the 'send' button and have the email go to the adjacent name selected in the 'reviewername' field.  I displayed the properties for the 'reviewername' drop down list in case that helps.  Thank you!  bella


  • 08-04-2009 11:31 PM In reply to

    Re: unable to get the fields value in current row of a changed event in a repeating table

     One simple thing you could do is create a field called "emailRecipient" outside of the repeating group (you don't have to display it on the form) and then add a button with a rule that carries out these steps:

    1.  Set emailRecipient to the value of reviewername (when you are setting up the formula for this, the formula should just have reviewername, not a full absolute path.
    2.  Invokes the send e-mail data connection.

     Then set up the data connection to use the emailRecipient field as the value for the To: address.

     Would that work?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-05-2009 09:16 AM In reply to

    • bella
    • Not Ranked
    • Joined on 07-31-2009
    • Posts 9

    Re: unable to get the fields value in current row of a changed event in a repeating table

    Hi Jimmy...

    I love simple solutions and this one worked like a charm!  Thank you...thank you!  Bella

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