Email Data in Current Section of Repeating Section - InfoPath Dev
in

InfoPath Dev

Email Data in Current Section of Repeating Section

Last post 07-16-2009 12:24 PM by JFlye. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-15-2009 05:38 PM

    • JFlye
    • Not Ranked
    • Joined on 07-15-2009
    • Posts 3

    Email Data in Current Section of Repeating Section

    Hi everyone,

    I have been pulling my hair out and searching everywhere, but I cannot figure out what is going wrong here. I have a repeating section with a series of fields, which I would like to have their contents emailed to a specific user. Within the repeating section (at the bottom), is the "Email" button, which should grab the fields in the section relative to itself and email them off.

    I think Ive narrowed my problem down to that wonderful "position()" function. The result of the button is that it successfully emails with all the correct fields the first action item every single time.

    Here is my code (I am using VBScript and InfoPath 2007):

    titlevar = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems/my:ActionTitle[position()]").text
    descripvar = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems/my:ActionDescription[position()]").text
    duedatevar = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems/my:ActionDueDate[position()]").text
    priorityvar = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems/my:ActionPriority[position()]").text
    efforttitle = XDocument.DOM.selectSingleNode("/my:Effort/my:Definition/my:Title").text
    actionitemnum = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems/my:CurrentPosition[position()]").text
    CORPactionowner = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems/my:AssignedToCORP[position()]").text
    EXTactionowner = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems/my:AssignedToExt[position()]").text
    ownerspace = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems/my:AssignedToSpace[position()]").text
    EXTemail = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems/my:EXTemail[position()]").text

  • 07-16-2009 02:14 AM In reply to

    Re: Email Data in Current Section of Repeating Section

    have you looked at Greg's examples on position()? http://www.infopathdev.com/files/folders/examples/entry277.aspx

    You should also search for "axis" and read Greg's blog on that if the link above doesn't help elucidate.

    Patrick Halstead
    Project Manager at Qdabra
  • 07-16-2009 06:27 AM In reply to

    • JFlye
    • Not Ranked
    • Joined on 07-15-2009
    • Posts 3

    Re: Email Data in Current Section of Repeating Section

    Thank you so much for your reply! I appreciate your help!

    From the above link and Greg's blog, I now have a field "Current Position" whose default value is count(preceding-sibling::ActionItems) + 1 to determine the number of nodes in the repeating section "ActionItems".

    I am having difficulty, however, filtering by that number to reach the current node. I cannot seem to reference it correctly in my Xpath. My code now looks like this:

    titlevar = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems[number(../my:CurrentPosition)]/my:ActionTitle").text
    descripvar = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems[number(../my:CurrentPosition)]/my:ActionDescription").text
    duedatevar = XDocument.DOM.selectSingleNode("/my:Effort/my:Action/my:ActionItemsOpt/my:ActionItems[number(../my:CurrentPosition)]/my:ActionDueDate").text
    ...

    I would really appreciate any help you have!

  • 07-16-2009 12:24 PM In reply to

    • JFlye
    • Not Ranked
    • Joined on 07-15-2009
    • Posts 3

    Re: Email Data in Current Section of Repeating Section

    Sorry to multiple post, but Ive learned some things about my issue and I thought it might help anyone who gets the chance to help me!

    The "Current Position" field, which holds my "count(preceding-sibling::ActionItems) + 1" equation does get the right number, but like my other fields must be filtered to the appropriate node to give me that number (i.e. /my:CurrentPosition = 1 even if I have 2 nodes on the form; yet /my:CurrentPosition[2] = 2). So really this doesnt help me, as my original problem still stands - how to filter to that node!

    I am looking for one of two solutions (that I can think of):

    1. Be able to declare a variable in my VBScript for the button that I can pass into the filter (i.e. /my:CurrentPosition[variable] )
    2. Find a way in XPath to reference my current node (I have tried  /my:CurrentPosition[position()]  with no effect

    I would really appreciate anyone's help!

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