How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource - InfoPath Dev
in

InfoPath Dev

How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

Last post 02-19-2011 01:56 PM by Patrick Halstead. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 02-16-2011 06:59 AM

    • gaya_b
    • Not Ranked
    • Joined on 02-16-2011
    • Posts 5

    How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

    Hello,

    I am new to Infopath Development and was hoping someone could help me out. I have a form which calls a webservice that retrieves information for a user from AD. I was able to copy the regular string fields into the main data source, but I am having trouble copying a repeating string field into the main data source (which currently binds to a repeating table in the form). What is the best way to do this? The reason I need to do this is that the infomation needs to be available in view mode without calling the webservice, so I need to store that info in the main data source.

    This is the structure of my webservice datasource

    myFields
    queryFields
    dataFields
     -response
     -result
       -string(repeating)

     Any help would be greatly appreciated!

    Thanks.

  • 02-16-2011 10:24 AM In reply to

    Re: How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

    Hi,

    Have you reviewed this article from Microsoft that explains how to deign your form for offline use?

    http://office.microsoft.com/en-us/infopath-help/design-a-form-template-for-offline-use-HA010211739.aspx

    The offline scenario is one of InfoPath's big advantages!

    Hope that helps

    Ted

  • 02-16-2011 11:41 AM In reply to

    • gaya_b
    • Not Ranked
    • Joined on 02-16-2011
    • Posts 5

    Re: How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

    hi,

    thank for the suggestion. I implemented the steps in the article, but got an error from the webservice saying "Infopath could not store this data on the form". would you have any other suggestions?

     thanks.

  • 02-16-2011 11:10 PM In reply to

    Re: How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

    Hi Gaya_B,

    That's a strange error. We will need more information from you. Maybe you can attach your form or screenshots.

    Thanks!

    Patrick Halstead
    Project Manager at Qdabra
  • 02-17-2011 04:17 AM In reply to

    • gaya_b
    • Not Ranked
    • Joined on 02-16-2011
    • Posts 5

    Re: How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

    Thanks for getting back to me. Would you mind helping me if I took a different direction? How can I copy data from my secondary data source (webservice that returns a repeating string) to my main datasource?

    Thanks,

    Gaya

  • 02-17-2011 07:28 AM In reply to

    • gaya_b
    • Not Ranked
    • Joined on 02-16-2011
    • Posts 5

    Re: How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

    I should probably be more clear with what I am trying to achieve. My secondary datasource (webservice that queries AD) returns a repeating string. How do I iterate through this string and save to a repeating field in my main datasource? The secondary repeating field currently binds to a repeating table - do I iterate through the table or work directly with the secondary datasource? I am really confused as to how to go about this...any help really appreciated.

    Thanks,

    Gaya

  • 02-18-2011 11:42 AM In reply to

    Re: How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

    Hi Gaya,

    You can use the Eval(eval(...)) trick to iterate xpath functions but there is no xpath function for copying values from a secondary data source, so you have to use some code. Since we get asked this question a lot, we created qRules back in 2007 to address the common coding questions that we get asked a lot. qRules can do a filtered copy from a repeating table in a secondary data source to the main data source or vice versa.

    To use qRules you will need InfoPath 2007 or 2010. If you are doing browser-based forms in 2007, you will need to admin deploy them, which is not too hard but does complicate publishing. SharePoint 2010 gets around this with sandboxes.

    If you're interested, we can arrange to have someone call you and show you a sample of how to go about doing what you have described with qRules. If you can attach a sample XSN with instructions (just type into InfoPath view the instructions of what you want to happen), I will inject qRules and show you the technique over the weekend.

    Let us know.

    Patrick Halstead
    Project Manager at Qdabra
  • 02-18-2011 12:48 PM In reply to

    • gaya_b
    • Not Ranked
    • Joined on 02-16-2011
    • Posts 5

    Re: How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

    thanks so much, patrick, but I figured it out! I don't know if it's the best way, but this is what I'm doing -

    XPathNavigator serviceNav = DataSources["SecDataSourceName"].CreateNavigator();
    XPathNodeIterator nodes = serviceNav.Select("/dfs:myFields/dfs:dataFields/...", NamespaceManager);

    while (nodes.MoveNext())
    {
        messageBox.Show(nodes.Current.Value);
    }

    I'm copying nodes.Current.Value into a repeating table.

    thanks again,
    gaya

  • 02-19-2011 01:56 PM In reply to

    Re: How to view Data retrieved from a webservice when the form is offline and/or copy data to main Datasource

    Great! Thanks for posting your solution.

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.