problem with current() in repeating table - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

problem with current() in repeating table

Last post 07-31-2008 05:26 AM by GazM. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-11-2007 10:29 AM

    problem with current() in repeating table

    I'm using InfoPath 2003 SP2. 

    I have a repeating table in an InfoPath form.  When an item is selected in a drop-down (ddlTeamname) I want to automatically populate a textbox.  The dropdown is filled by a secondary data source called "Contacts".

    This does not work; it fills the textbox with the first element in the data source, no matter what is selected in ddlTeamname:

    xdXDocument:GetDOM("Contacts")/dfs:myFields/dfs:dataFields/dfs:Contacts/@E-mail_Address[../@Full_Name = xdXDocument:get-DOM()/my:myFields/my:group1/my:group2/my:ddlTeamName]

     From reading several posts on the site, I understand that I need to substitute "current()" for the call to "get-DOM" to get the value selected in the dropdown ddlTeamName.  But, when I try using current() (like below) I get nothing in the textbox:

    xdXDocument:GetDOM("Contacts")/dfs:myFields/dfs:dataFields/dfs:Contacts/@E-mail_Address[../@Full_Name = current()/my:myFields/my:group1/my:group2/my:ddlTeamName]

    I've tried every possible path after current() (taking away each level one-by-one, until I'm calling "current()/my:ddlTeamname", but my textbox never fills.

    Can anyone tell me what I'm doing wrong?

    Tom Regan
  • 06-12-2007 09:39 AM In reply to

    Re: problem with current() in repeating table

    Your correct XPath entirely depends upon exactly what current() evaluates to. For example, if current() evaluates to my:group2, then current()/my:ddlTeamName makes sense. However, if current() evaluates to my:group2/my:SomeOtherField, then you would need to use a relative XPath to get back to the one you want, like this: current()/../my:ddlTeamName.

    You need to know what current() evaluates to in order to use it properly.

  • 07-31-2008 05:26 AM In reply to

    • GazM
    • Top 200 Contributor
      Male
    • Joined on 11-09-2005
    • England
    • Posts 54

    Re: problem with current() in repeating table

    Tom

    If you haven't already found a solution to this problem, try this one

    http://www.infopathdev.com/blogs/matt/archive/2006/04/18/Automatically-Populate-Fields-from-a-Drop_2D00_Down-Selection.aspx

    It worked for me.

    Gary

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