Need help with autopopulate and update - InfoPath Dev
in

InfoPath Dev

Need help with autopopulate and update

Last post 05-01-2007 01:43 PM by Clay Fox. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-01-2007 09:57 AM

    Need help with autopopulate and update

    I'm a total noob with Infopath.  I'm trying to design a screen where the user selects an ID number from a dropdown.  The app then reads a record from a SQL Server table and populates fields for subsequent update.  For the life of me, I cannot figure out how to do this in Infopath.

     I found a website that kinda explained it.  The sample they gave was looking up a company address, etc. through entry of a company id.  Sounds pretty much like what I wanted, so I copied their code and changed it to point to my datasource, etc.   The website is http://radio.weblogs.com/0131777/stories/2004/02/27/howToPopulateItemsFromASecondaryDataSource.html

    I am getting an error on line 14:  Xdocument.DOM.setProperty("SelectionNamespaces", 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:q="http://schemas.microsoft.com/office/infopath/2003/ado/queryFields" xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-04-30T13:57:22" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"');

    The error message says that Xdocument is undefined.  I have two questions:

    1.  Is there an easier way to do what I want to do than what is shown on that website?  If so, what do I need to do?

    2  If not, how do I fix the Undefined error?

    Thanks!!

  • 05-01-2007 01:43 PM In reply to

    Re: Need help with autopopulate and update

    There are multiple ways of accomplishing this.  I am not sure if you are using another form as a template or starting from scratch or if you are using code or just using rules.  To test this and do some learning I would recommend creating a new form from scratch.  Select Database as the type and connect it to your datasource and select the table on your sql server which has the records you want to read or you can use the sample Northwinds DB.  What you will get is a sample form that has all of the fields of your table in the data source, both under queryfields and datafields. Drag the queryfields folder into the query area as a section with controls and drag your datafields folder into the lower section as a repeating table. You can immediatly preview the form.  Enter an ID number in the field under query or some other indexed data and select the query button. This should display below the data records that match.

    So in your case you would have a dropdown and when it was selected you would set the value of the approriate field under queryfields and then query the dataconnection.

    Hopefully this can get you started experimenting with dataconnections to a DB.

    Webservices are better but if you just need simple interaction with a table this works.  Unfortunately with InfoPath you have a limitation of only having one table you can query and submit to. You can get around this with web services. 

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