Xpath Syntax for Secondary Data Source - InfoPath Dev
in

InfoPath Dev

Xpath Syntax for Secondary Data Source

Last post 08-09-2011 06:00 AM by Erich. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-08-2011 01:36 PM

    • Erich
    • Not Ranked
    • Joined on 07-27-2011
    • Posts 11

    Xpath Syntax for Secondary Data Source

    Hi,

    Here is the selectSingleNode statement producing an error ("Object required")

    XDocument.UI.Alert(XDocument.DOM.selectSingleNode("dfs:myFields/dfs:dataFields/d:BC_Verification[@BC_ID = my:myFields/my:user]/@Name").text);

    Where 'dfs' and 'd' are the namespaces of the secondary data source, and 'my' for the primary source.

    BC_Verification attributes:

    1. BC_ID
    2. Name 

    'user' is a pre-filled field in the form being used to filter a BC_Verification entry where BC_ID = user. Any ideas on what's giving the error?

    Erich

  • 08-09-2011 12:58 AM In reply to

    Re: Xpath Syntax for Secondary Data Source

    This can be done fairly simply with rules and such, but in code it's not possible to have a single XPath reference two data sources.

    You could first get the my:user value and concatenate it into another XPath, but the JScript syntax for accessing a 2DS is somewhat involved.  Is there some reason you can't use a rule to show this alert?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-09-2011 06:00 AM In reply to

    • Erich
    • Not Ranked
    • Joined on 07-27-2011
    • Posts 11

    Re: Xpath Syntax for Secondary Data Source

    Yes, what I would like is to store the value of the 'Name' attribute from the secondary data source as a global variable. My problem is that it appears script is executed before rules are, so when I try to extract the 'Name' attribute from a rule-calculated field, it returns an empty string since the rule has not yet been applied.

    Erich

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