Dynamically pulling data for data connection - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Dynamically pulling data for data connection

Last post 05-02-2011 12:53 PM by Caeanis. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-08-2010 05:53 AM

    Dynamically pulling data for data connection

     I have a form which I have set up to filter data in a universal data connection based on the user's login.  The underlying xml file is 2.5 mb and takes a while to load.  It seems that filtering also is taking longer than I'd expect as well.  I decided to try to dynamically pull the filtered data from the xml file via a web service which I've been able to do.  When I run the code to pull the data I get back an xml node that contains what I want, however I'm not sure how to use this to populate the secondary datasource my controls are set to.  Ideally I would like to have this pulled on the load event or internal startup so that I'm not pulling the whole file, and then pulling an extract.  I feel like I'm almost there but the 'ol noggin isn't firing on all cylinders.

     

    Caeanis

  • 11-08-2010 08:17 AM In reply to

    Re: Dynamically pulling data for data connection

     Ok I am trying something here.  I'll post the code and if someone can tell me if I'm on the right track or if there are specific reasons why I shouldn't do it this way, please let me know.  Currently this code pulls the whole set of data over, and then swaps out the part I'd been filtering to.  My goal is to figure out how to do this so that I'm only pulling the info from the web service. 

                ' vb doesn't use xDocument, so I cheated and added a reference to Microsoft.Office.Interop.InfoPath
                Dim mgr as String
                Dim xDoc As XDocument
                Dim oldData As XmlNode

                ' mgr = UCase(Environ("UserName"))
                ' I'm using the above line real-time, for testing I'm using a manager's Login Id
                mgr = "MAYOUNG"

                ' reference to my webservice
                Dim myData As New tar.Service1
                Dim myNode As XmlNode
                ' retrieve the xml node from the webservice specifically for this manager
                myNode = myData.GetData(mgr)
                ' set the xDoc object to this document
                xDoc = Me
                ' set oldData xmlnode to the top node in the secondary data source,
                ' I want to figure out a way to replace or populate it before the form loads if possible
                oldData = xDoc.DOM.selectSingleNode("/Data")
                ' Use the replace child method to swap out the whole data set for just the nodes pertinent to the current manager.
                xDoc.DOM.replaceChild(oldData, myNode)

  • 11-10-2010 10:22 AM In reply to

    Re: Dynamically pulling data for data connection

     Again I spoke too soon.  Now after changing my secondary data connection to the  web service, the form gets an error before coming up.  "Infopath is unable to open the form".  No other info.  I tried setting breakpoints in the code in case that was where the problem was but it is erroring before hitting my code.  I am currently running the web service locally from localhost so maybe that is where the problem is, or maybe it isn't pulling the data back fast enough to populate the form.  Not sure.  Is there a way to "debug" the initial start up of the form so determine where the problem is?

  • 11-10-2010 10:37 AM In reply to

    Re: Dynamically pulling data for data connection

    Hi --

    I've read your 3 posts, and confess I'm confused. Is this IP 2007? or 2003? This comment in your code confused me:

    'vb doesn't use xDocument, so I cheated and added a reference to Microsoft.Office.Interop.InfoPath

    As far as that horrid error, I'm guessing you are getting this in preveiw, is that the case?

    If so, try opening the form as if you were going to fill it out rather than previewing. Sometimes you get a better error message. Usually if I get that error in preview, it is because I've set preview to use a data file and deleted or moved the data file.

    Hilary Stoupa

  • 05-02-2011 12:53 PM In reply to

    Re: Dynamically pulling data for data connection

     I am using IP2007.   Thank you!

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