Alec Pojidaev's InfoPath Blog
Stuff published for no reason (cool codeless infopath solutions mostly)

How to remove initial row in repeating tables (or delete all rows) with rules only

Bookmark that post

Special thanks: Karl D. Swartzendruber

First of all you have to place your repeating group into the non repeating one. So your field structure should be looking like that:

Field structure

Field structure

Then as you can see the simple rule f=cleaningGroup will delete all rows. Now we are getting to the point why it never been implemented before. As soon as you will try to assign any value to a group InfoPath will yell at you with the message: “You must select a field. Groups do not have values and therefore cannot be assigned to by this action.” Let’s prove that at least “cannot be assigned” part of that statement is false.

It’s time for some rule breaking.

Now we will screw up the group (“f” in our case) by giving it a temporary name. Create a field at the same level as your group formerly named “f”. Name that field … guess what? Right, with the name “f”. Now InfoPath UI won’t be objecting when you’ll try to create button rule f=cleaningGroup. Delete field “f”. Rename your group back to its original name: “f”.
The Form to test. Web browser forms OK.

Deleting single row from the repeating field.

Here is form that is doing exactly this. The way it was created (renaiming hack) is similar to the previous form. There are several limitations assosioated with this approach. First is it supports single repeating field not repeating group. Another “feature” you have to consider before you decide to use this form is unchecking checkbox at single row will delete all rows with the same value (might be useful in certain scenarios). Also because of Multiple selection check box this form can be made browser enabled in SP2010 only.

9 Responses to “How to remove initial row in repeating tables (or delete all rows) with rules only”

  1. You rock. This is awesome!

  2. The solution rocks. It really does.

  3. Awesome! So simple, but it works perfectly!

  4. Is there a way to only remove a single row instead of all rows? I know the default functions allows for this, but I am trying to remove all of that and simplify the end user experience

  5. you r great great great. you solved my major issue.

  6. Instead of adding and renaming, you can select any input field like name = ” cleaningGroup “, then open your manifest file in xml editor and search by your rule name and rename your name filed with ” f “. For verification open your rule and will see ” f = cleaningGroup “. Cheers :)))


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 40 other followers

%d bloggers like this: