XPath for Rule - InfoPath Dev
in

InfoPath Dev

XPath for Rule

Last post 05-22-2012 02:25 PM by patrickli415. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-22-2012 11:05 AM

    XPath for Rule

     Hello,

    I'm trying to insert a value into a field(Thaw_Date) if data in the secondary data source matches up with a field (Brx_Lot) in the current form.  I'm a novice at XPath but I have the following code:

     

    xdXDocument:GetDOM("InfoPath")/dfs:myFields/dfs:dataFields/dfs:InfoPath[@Brx_Lot = /my:myFields/my:brx_lot]/@Thaw_Date

     

    I want it to be returning the Thaw_Date if the Brx_Lot in the secondary source is equal to the brx_lot in the current form.  I have taken a look at the XML and I don't see the dataFields or InfoPath nodes but it was what InfoPath put into the XPath after selecting a field.  In addition, if anyone could clarify the use of the "@" (I know it as an attribute identifier, but it seems to be referring the the value of a node in InfoPath) that would be great.

     

    Thanks!

  • 05-22-2012 12:02 PM In reply to

    Within those brackets, the XPath is in the context of the secondary data source, so to refer back to the main data source, you need to use xdXDocument:get-DOM():

    xdXDocument:GetDOM("InfoPath")/dfs:myFields/dfs:dataFields/dfs:InfoPath[@Brx_Lot = xdXDocument:get-DOM()/my:myFields/my:brx_lot]/@Thaw_Date

    The @ symbol is indeed for referring to attributes, and I daresay that is its sole purpose in XPath.  In this your post, @Brx_Lot is referring to the Brx_Lot attribute, and @Thaw_Date refers to the Thaw_Date attribute.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-22-2012 02:25 PM In reply to

    Oh!  That makes so much sense now.  I was running under the assumption that InfoPath dealt with XML Nodes like Access does with tables but it makes complete sense that you need to refer to the main source.  I'll try this and see if it works!

     EDIT: Success!  Thanks for the help Jimmy!

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