MS Office Forum / General MS InfoPath Questions / September 2005
InfoPath Form with XML Datasource
|
|
Thread rating:  |
NikV - 25 Aug 2005 15:06 GMT Hi; I have two tables in a database. I've created triggers to each table that will run anytime a change is made to the table. The trigger will spit out a XML file from each table. I want my InfoPath template to use the new XML file as a data source so that the user will always have "fresh" data. Everytime the XML file is generated it will overwrite the old XML files.
Since InfoPath templates are cab files can this be done? Hope someone can help. Thanks!
Scott L. Heim [MSFT] - 25 Aug 2005 20:17 GMT Hi,
I am assuming the XML file you are referring to is setup as a "secondary data source" for your InfoPath solution - is this correct? If so, when you setup this data source, the last screen of the wizard asked if you wanted to include this file as a "Resource" file. If you clicked Yes to this, then no - InfoPath is going to use the data from the Resource file. However, if you clicked No to this option, then InfoPath is looking to wherever this file resides for the data so it will automatically pickup the changes.
I hope this helps!
Best Regards,
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
NikV - 25 Aug 2005 20:40 GMT Scott; Thanks again...seems like I always get you. Anyway, if I am understanding this correctly I don't need to make my XML a Resource file when setting the Data Source? So if I just point it to where ever...it should work and update the infopath form when my XML file updates?
> Hi, > [quoted text clipped - 14 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights Scott L. Heim [MSFT] - 25 Aug 2005 21:00 GMT Hi,
Exactly...with the understanding that unless you implement a method to allow the user to "query" to see if there is new data, it will reflect the updated data the next time the form is opened.
Best Regards,
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
NikV - 26 Aug 2005 15:58 GMT Scott, Maybe I'm doing something wrong here. I point the XML file to the correct location and did not make it Resource File as you recommened. But when I go back and change something in the XML file and then I run the Infopath form the data does not get updated. It will still show the "old" data.
As usual can you please walk me through on how to make it that XML will update the form at all times with fresh new data?
> Hi, > [quoted text clipped - 8 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights Scott L. Heim [MSFT] - 26 Aug 2005 16:30 GMT Hi,
Test these steps:
- Create a new XML file using the following:
<?xml version="1.0" encoding="UTF-8"?> <companies> <company> <companyName>A</companyName> </company> <company> <companyName>B</companyName> </company> </companies>
- Save this as: CompanyList.XML - Create a new, blank InfoPath form - From the Tools menu choose Data Connections - Click Add - Select Receive Data and click Next - Select XML Document and click Next - Click the Browse button, select CompanyList.XML and click Next - Click Finish - When prompted about adding the file choose No - Click Close on the Data Connections window - Add a drop-down list to the form - Right-click on the drop-down list and choose Properties - From the List Box entries section choose the option "Look up values in a data connection..." - From the Data Connection box choose Company List - Click the Select XPath button next to Entries, highlight Company and click OK - Click OK to get back to your form - Save and close the XSN - Double-click this file to open a new form, click on the drop-down list and you should see 2 companies: A & B - Close this form - Open the XML file with Notepad (or an XML editor of your choice) - Add a new "company" element as follows:
<company> <companyName>C</companyName> </company>
- The XML file should now appear as:
<?xml version="1.0" encoding="UTF-8"?> <companies> <company> <companyName>A</companyName> </company> <company> <companyName>B</companyName> </company> <company> <companyName>C</companyName> </company> </companies>
- Save and close the file - Double-click this file to open a new form, click on the drop-down list and you should now see 3 companies: A, B & C
Does this work for you?
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
NikV - 29 Aug 2005 21:46 GMT Scott; Dang it! I was clicking when InfoPath prompted me to: "prompted about adding the file choose No". Thanks for everything Scott, again you are the best!
> Hi, > [quoted text clipped - 66 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights Scott L. Heim [MSFT] - 30 Aug 2005 12:38 GMT It's always the little things in life...isn't it! :-)
Glad to hear this is working for you!!
Take care,
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
NikV - 30 Aug 2005 15:29 GMT Scott; One more question:
I have two XML files that contain data for my drop down box, text boxes, etc. I have an SQL Database that will store my data after clicking Submit on my InfoPath form. The primary key is ProjectNumber.
The data types for all the tables are char, varchar, date, and numeric. What is the best way to create a Submit function in InfoPath with the above resources? Is it best to create a Main Data connection with the SQL database and add secondary data sources with the XML files? This way I can use the built-in Submit function? Thanks in advance Scott.
> It's always the little things in life...isn't it! :-) > [quoted text clipped - 6 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights Scott L. Heim [MSFT] - 30 Aug 2005 15:46 GMT Absolutely - if you eventually want to store your data in SQL Server, then you will want to create your InfoPath solution from SQL Server and simply add the XML files as secondary data sources.
Best regards,
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
NikV - 31 Aug 2005 19:44 GMT Scott; I have a question that I cannot find in any text book. Let's say that I have a "HyperLink" in an infoPath form. Everytime a user hits that link it show them a "hidden text box". Can this be done in InfoPath?
> Absolutely - if you eventually want to store your data in SQL Server, then > you will want to create your InfoPath solution from SQL Server and simply [quoted text clipped - 6 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights Scott L. Heim [MSFT] - 01 Sep 2005 15:10 GMT Hi,
Although someone else may have found a way to do this, I don't see where this is possible since there are no "events", conditional formatting options, etc. that would let you know this has occurred.
Scott L. Heim Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
NikV - 01 Sep 2005 15:16 GMT Darn. Thanks Scott!
> Hi, > [quoted text clipped - 6 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights
|
|
|