I am fairly new at Infopath and hope that I am about to explain effectively what I need. I have a SQL database that is used as the source for both input and data retrieval. The problem is that the Main Connection for my Infopath 2003 form must be the data input connection (so other forums have indicated) otherwise they will not work as expected to be able to update the data if at all. Alternatively, it would seem my data retrieval connection also needs to be the Main Connection to get the cascading dropdowns to work properly (so I have found out using trial and error). Here's the scenario.
DATA CONNECTION (1)
For one form, I need to pull data from the database that will populate two dropdowns: one is LOCATION, the other is COMPANY. These two tables in the database are joined by a third table "LOCCOY" that takes care of the many-to-many relationship that LOCATION and COMPANY have with each other. I use a filter on each of the dropdowns to filter out duplicate values.
- Location dropdown: not(.=../preceding-sibling::*/@LOCATION)
- Company dropdown: not(.=../preceding-sibling::*/@COMPANY)
This works great if the LOCATION, COMPANY and LOCCOY tables are setup in the Main Connection of the form but set as the secondary, the filter on the second dropdown filters out more than expected.
DATA CONNECTION (2)
The second form allows for updating to the database and although this works, I don't want the person doing the updating to be able to update the LOCATION, COMPANY, DEPARTMENT information. If the user types the LOCATION and COMPANY exactly correct, it will retrieve the DEPARTMENTS associated as well as the related personnel data and allow them to update it but what I would like to do is present the LOCATION and COMPANY to the user via one of two methods.
METHOD 1: Originally, I had thought to use dropdowns in the same form to filter the LOCATION and COMPANY but as I mentioned earlier, this method would require the dropdowns' data connection to be set as the primary connection which doesn't seem to work properly for an update form.
METHOD 2:
Secondly, I figured I would trigger a form load (much like a pop-up) from a button on the primary form, to load a second form that would provide a means to select the LOCATION and COMPANY info (thus allowing the data retrieval as the Main Connection) using the dropdowns that are populated from the database, then have them populate back onto the main forms' LOCATION and COMPANY fields.
The part that I am stuck on is: How do I get the values of form 2 to populate back into the equivalent fields in form 1. I am not particularly good at XML and would appreciate any help you could provide.
Thanks much.
-Shanty
P.S. I've tried 3 times to get the formatting to hold as it is horrid to read otherwise, but I apologize if this isn't easy to read/follow.