Accessing dataObject outputs and controls programmatically - InfoPath Dev
in

InfoPath Dev

Accessing dataObject outputs and controls programmatically

Last post 03-29-2011 02:15 PM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 03-29-2011 09:15 AM

    • pamam
    • Not Ranked
    • Joined on 03-28-2011
    • Posts 6

    Accessing dataObject outputs and controls programmatically

    My system is Infopath 2003 SP1? Windows XP SP3 in conjuction with SharePoint; however I just now working with InfoPath separately. 

     It is difficult to find out what the XPath is for a control or dataObject input or output.

    I also noticed that some of the DataObject Adapters are not available.  When I try to use WebServiceAdapter I get a syntax error "not supported object" or something to that affect.

    Knowing what prefixes to use on the XPath would be a great help. 

    I would appreciate any help.

    Mel

  • 03-29-2011 09:24 AM In reply to

    Re: Accessing dataObject outputs and controls programmatically

    Hi and welcome --

    It would be helpful to know what version of InfoPath you are using. For 2007 and above, you can right click a field or group in the data source task pane and select "Copy XPath" to get the XPath to a node.

    According to MSDN, the WebServiceAdapter has been with us since IP 2003. The line of code you get the error on may help us help you debug it.

    If you save your form as source files, you can look at the sampledata.xml file to see the namespace prefixes for your different data sources (if you are using IP 2003 and don't have the Copy XPath functionality). You can also find the XPath to fields using the formula editor (click the box that says "Edit XPath" to display the full XPath).

    Hilary Stoupa

  • 03-29-2011 09:39 AM In reply to

    • pamam
    • Not Ranked
    • Joined on 03-28-2011
    • Posts 6

    Re: Accessing dataObject outputs and controls programmatically

    Thanks Hilary, that was very informative.  I had no idea that these options were available.

    **** 

    set dataObj = XDocument.DataObjects("GetDatePlusDays")

    XDocument.UI.Alert( "DataObjects Connection: " & dataObj.WebServiceAdapter.Connection.Name )

    ****

    The GetDatePlusDays is a webservice secondary datasource.  The only adpater that seems to work is Adpater.

    The actual error message is the the object does not support this property or method.

    Thanks,

    Mel

  • 03-29-2011 11:04 AM In reply to

    Re: Accessing dataObject outputs and controls programmatically

    You'll see from the MSDN link I referenced that:

    For secondary data sources, the WebServiceAdapter object is accessible through the QueryAdapter property of the DataObject object, and DataObject objects are accessible through the DataObjects property of the XDocument object.

    The code sample shows that you'd want:

    set dataObj = XDocument.DataObjects("GetDatePlusDays").QueryAdapter

    I don't see a Connection property in MSDN? But I do see a Name property -- so you should be able to get the name with:

    dataObj.Name

    Hilary Stoupa

  • 03-29-2011 12:38 PM In reply to

    • pamam
    • Not Ranked
    • Joined on 03-28-2011
    • Posts 6

    Re: Accessing dataObject outputs and controls programmatically

    Hilary,

    In my world that does not work.  This works

     set dataObj = XDocument.DataObjects("GetDatePlusDays")

    but

     set dataObj = XDocument.DataObjects("GetDatePlusDays").QueryAdapter

    does not work.  I always get an error of "object does not supported property or method"

    I can see it in the DOM but the compiler in InfoPath does not see it.  could I need another service pace or something.  I'm running into this with other objects as well.

  • 03-29-2011 02:15 PM In reply to

    Re: Accessing dataObject outputs and controls programmatically

    The oldest version of IP I have installed is IP 2007, SP 2, I'm afraid. In IP 2007, SP 2, I can use the following:

    set dataObj = XDocument.DataObjects("GetDatePlusDays").QueryAdapter

    With the name of my own data connection instead of "GetDatePlusDays", of course. Hopefully someone with IP 2003 SP 1 will be able to chime in.

    Hilary Stoupa

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