Working with Repeating Tables

S

Serhan.Saral

Hi Guys,

I'm new to Infopath and I'm trying to create a repeating table to hold
Revision History data for a document and link that to an SQL database.
I was able to link other text boxes to my SQL data source, but can't
get the repeating table to work with my SQL tables.

My SQL table for Revision History is a called SME9_RevHist, with the
following columns:

S90Key is the Primary Key for the table
S91Ver is for the version number
S92VerDate is for the Date the version was updated
S93Auth is for the Author name who made the version update
S94Comm is for Additional comments

Next I created a repeating group called RevInfo with the following
elements:
Ver
VerDate
Auth
Comm

So, how can I now connect the elements in the repeating group the my
SQL table and be able to store and retrive information typed into these
fields when using the form or do I need to go down a different path...

thanks, a bunch
ssaral
 
L

Larry Spencer

First, let's make sure your Data Source is set up correctly. Here's
one way to do it. (I'll assume you have Service Pack 1. I don't know
if the interface would differ without it.)

1) Design a new form / New from Data Connection to invoke the wizard.
The following steps are all within the wizard.
2) Choose the Select Database radio button (not Web Service).
3) Select the database.
4) Select your main (parent) table.
5) Press Add Table, then pick the child table (SME9_RevHist).
6) The Edit Relationship dialog appears. Specify the relationship
between the two tables, if it's not there already. (InfoPath will
infer a relationship based on foreign-key constraints if you have
them.)
7) The final screen of the Data Connection Wizard will let you name the
data connection. Pick a name then press Finish.

The Data Source area of InfoPath should now show your tables, with the
RevHist table as a repeating group of the main table.
From here, you have two choices:

1) If you want to show more than one document (parent-level record) at
a time, the Master/Detail control available in SP1 is the perfect
choice. Just drag the Group for the parent table to the results
section of the surface and InfoPath will create something to get you
started. Howver, you'll see that it puts every detail field in twice,
giving you a choice of locations. You'll probably want to delete one
or the other. You'll also want to format everything nicely by putting
the fields in Layout tables. But, as I said, InfoPath will set up a
basic and sound structure to start you off.

2) If you only want one parent record, but potentially many RevHist
records, create the parent controls in the normal way (it sounds like
you have already done this), then drag the Repeating Group for RevHist
from the Data Source to the design surface. InfoPath will pop up a
menu that gives you a choice of several formats. Your situation sounds
like a Repeating Table would be the best. InfoPath will automatically
create a suitable control for each field that's linked to your SQL
Server table.

You'll also need to create the fields in which the user enters query
criteria. You didn't mention any problems with that, so I assume that
part is good to go.

Now preview your form. Assuming you have no connectivity issues with
SQL Server, everything should work like magic!

Post again if you have any troubles, and I'll see if I can help.
 
S

Serhan.Saral

Yes, I'm using InfoPath with SP1, but had some issues creating the
data sources as you described. When I was adding tables to a data
source InfoPath always sets up the first table I added as a repeating
group and then when I tried to select another table using the Add Table
button that table was never setup as a repeating group.

I was able to fix this by identifying several columns in the RevHist
table as Key Columns to create unique entires. Everything seems to be
working now thanks for the help.
 
Top