How to change the name of a Complex InfoPath Data Source

Sometimes InfoPath doesn’t allow you to rename your main data source so you are stuck with a name that doesn’t necessarily match with the function of the form.  This is very common for those of us that like to use Microsoft’s InfoPath templates as a head start.  For example, a form designed based upon an InfoPath sample may include the "expenseReport" name. This is quite annoying especially when you need to compile the datasource with the "xsd /c" command and the output classname is less than helpful.

 

Below is the example of a form data source that was created using Microsoft’s “Expense Report” example form. 

clip_image001

 

How to rename the your data source

  • If this field is disabled when you open the properties window you will need to follow the steps shown below to rename the datasource
  • Open your form
  • Select file >> Save as Source Files
    clip_image002
  • Accept the signing message
    clip_image003
  • *** Close the form *** don’t skip this step
  • Open the schema.xsd file from the location where you saved the source (if you don’t see the schema.xsd then your datasource is not complex so you can still rename it using the right mouse key >> properties)
    clip_image004
  • Locate the element as shown below and rename it (sorry but you shouldn’t rename any of the target namespaces or xsns)
    clip_image005
  • (update the <xs:element to match the name you would like without spaces
    clip_image006
  • Save the shema.xsd
  • Open the original form and select Tools >> Convert Main Data Source
    clip_image007
  • Select the schema.xsd file you modified previously
    clip_image008
  • Choose No if InfoPath asks you "Do you want to add another XML Schema or XML document to the main data source?"
    clip_image009
  • Voila, your main Data Source’s top level element is renamed
    clip_image010
VN:F [1.9.1_1087]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.1_1087]
Rating: 0 (from 0 votes)

Popularity: 3% [?]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “How to change the name of a Complex InfoPath Data Source”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>