Xpath differently in expression box and text box - InfoPath Dev
in

InfoPath Dev

Xpath differently in expression box and text box

Last post 05-15-2006 11:26 AM by Matt Faus. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-11-2006 09:21 AM

    • CGlover
    • Top 500 Contributor
    • Joined on 01-21-2006
    • United Kingdom
    • Posts 34

    Xpath differently in expression box and text box

    I have a drawing schedule. Under each drawing is a list of revisions and a list of revisions. When I create an issue I want to print, and store in the issue tree, the latest revision number.

    This works in an expression box, but not in a text box (I get an error):

    ../../../../my:Drawings/my:Drawing[my:DwgNo = current()/my:IssDwgNo]/my:Revisions/my:Revision[last()]/my:RevNo

    This does not throw an error, but then it does not produce any result either:

    //my:Drawings/my:Drawing[my:DwgNo = ../my:IssDwgNo]/my:Revisions/my:Revision[last()]/my:RevNo

    This produces the correct answer in the text box, but only for drawing 1, of course:

    //my:Drawings/my:Drawing[my:DwgNo = 1]/my:Revisions/my:Revision[last()]/my:RevNo

    If anyone has an idea I would be grateful to hear about it.

    Rgds
    Clive Glover


  • 05-15-2006 09:52 AM In reply to

    Re: Xpath differently in expression box and text box

    current() for an expression box will typically be different than current() for a text box (or other control). This is because the context of the expression box is the container (table, section, etc) whereas the context of the text box is itself.
  • 05-15-2006 11:26 AM In reply to

    Re: Xpath differently in expression box and text box

    I have used this little trick several times today, maybe it will come in handy for you:

    Wherever you are trying to use the current() function put in this XPath: local-name(current()) and you will know instantly what node current() is refering to.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.