The default Expense Report form that’s shipped with InfoPath 2007 makes use of a table that shows the expense item details per row. Your requirement is
to add a new field where users can enter notes or comments for that particular expense item – you’d like to display this new field underneath the
already-existing row in the table, therefore having 2 rows for each item now.
The technique used in this blog doesn’t only apply to the Expense Report form but to all others where you’d want to show two rows per item in a
repeating group, instead of just one.
Adding a new field is easy:
1. In your main data source, locate the items group > item repeating group and add a new field called notes (you can set
it either as Text (string) data type or a Rich Text (XHTML) depending on your requirement).
Your main data source should look similar to this:
The tricky part is the layout – displaying the controls in two separate rows, and making the header/footer not repeat like how it is in a repeating
To achieve the layout we want, we need to skip using a repeating table and use a repeating section instead. Follow along…
2. Place your cursor where you want to display the section on the canvas - the Itemized Expenses layout table would probably be your pick.
Don’t delete the existing repeating table just yet so you can copy/paste or drag/drop some items over later.
3. In the Data Source taskpane, right-click on the items parent group and select Section – this will insert a section right
where your cursor is on the canvas. Set this section’s padding to 0px to get rid of the unnecessary white spaces inside the section and that all its
contents will stay as close to the edges as possible.
4. With your cursor placed inside the newly-added section, go to the Table menu > Insert > Layout Table… and insert a 5
columns by 3 rows table.
You may specify the number of columns you want depending on the fields you want to display. We’re adding 3 rows however, so we’ll have the top row for
our table header, 2nd row for the repeating section that will hold the expense item details (so merge the cells to make it 1 whole row
without columns), and the 3rd for the total amount of the expenses.
5. Place your cursor in the second row (the one you just merged) and again, set all the paddings to 0px.
6. Without moving your cursor where it’s at, right-click on the items repeating group and then select Repeating Section. This time,
set all its paddings and margins to 0px.
In InfoPath 2007, sections and repeating sections have some kind of invisible borders by default. Remove this by selecting the repeating section, and
selecting None in the Borders and Shading dialog.
Again, we’re doing all this to eliminate all the white spaces as possible in order to achieve that all-in-the-same table effect (like what a repeating
table would give) even though we’re using a repeating section.
7. With your cursor still inside the repeating section, insert a 5 columns by 2 rows table. The 1st row will hold the default details
(Date, Description, Category, Cost and the arrow button) while the second is for the new notes field.
8. Add the controls inside the table (you can drag and drop from the existing repeating table and delete it afterwards).
Adjust the formatting to your liking – resize the cells making sure that all the columns and rows are perfectly aligned, fix the paddings and margins,
add borders/shading, etc.
Your layout might look similar to this:
And in Preview, something like this isn’t bad at all:
Have fun! :)