Repeating Table – set color for alternative rows and auto number the rows

Set color for alternative rows:

Logic behind : Odd number of rows(1,3,5,7..) when divided by 2 will return the remainder 1  and even number of rows(2,4,6,8..) when divided by 2 will return the remainder 0. To find the remainder, we use mod(modulo) operator. To find whether the row is odd number or even number, we can use position() in infopath.

  • Go to Home->Manage rules
  • In fields pane, select the group containing repeating fields and add formatting rule
  • Under condition, click on None and select “The expression” in first drop down
  • To color the odd rows, enter the expression as position() mod 2 > 0 or position() mod 2 = 1
  • Under Formatting, select the color that you would like to apply in Shading(bucket symbol)

Color alternative rows

  • Click on Home->Preview to see the result

Auto number repeating table rows:

  • To auto generate number in SNO inside repeating table, right click on SNO ->Text Box Properties
  • Under Default values, click on fx and insert the formula, count(../preceding-sibling::my:group2) + 1 and click ok

  • You can also use position() instead of the above formula but this will not be supported in InfoPath 2013 text box. However, it can be used in Calculated value in InfoPath 2013. Right click the SNO ->Change Control->Calculated Value and enter position() in XPath

  • Click on Home -> Preview to see the result.



Repeating Table – Set default number of rows and limit the total number of rows

Repeating table plays a vital role in form library to insert several rows of data in a single form. In this post, let’s see two different methods of setting the default number of rows and limiting the total number of rows in repeating table.

METHOD 1 – Using Default Values and Rules

Set default number of rows:

  • Go to Data tab in the ribbon and click on Default Values
  • In Edit Default values dialog box, right click on group that contains the repeating table fields and select “Add another group below”. Repeat this step to increase the default number of rows
  • Click on Home->Preview to see the result.

  • Limitation – You will not be able to remove the rows inserted by this method

Limit total number of rows:

  • Go to Home tab and click on Manage rules
  • Select the group(group2 in above picture) that contains repeating fields in Fields pane
  • In Rules pane, click on New -> Formatting
  • Under condition, select “The expression” in first drop down, type the expression value as count(/my:myFields/my:group1/my:group2) = 6
  • Under Formatting, tick the box “Don’t allow users to insert or delete this control” as depicted below

  • Now, when the user inserts the 6th row and click on insert item, rows will not be created and drop down highlighted below shown till 5th row will disappear on inserting 6th row to prevent insertion and deletion.

METHOD 2: (Modifying the Source File)

  • After designing the form with repeating table, click on Publish -> Export Source Files

  • Browse the location and type the folder name to save the source file

  • Close the InfoPath form and open “myschema.xsd” from source file folder

  • To set default number of rows, change the minOccurs value as shown below
  • To limit the total number of rows, change the maxOccurs value as shown below

  • Save myschema.xsd and close it
  • Open manifest file in Design mode, preview and publish it
  • Now, when the user tries to insert 11th row, below error will be shown.

Link to Email in InfoPath form

We all know how to create a link to an email in html page using the anchor tag. Do you know that the same is possible in InfoPath Form? Yes, we can do the same in infopath form in much simpler way. Here are the steps:

  • Consider the below Thank You Page(view) where we need to create a link to email for “Sathiya”


  • Select the word and click on Insert->Hyperlink under Links section


  • In Insert Hyperlink dialog box, type the email address as in address box and click ok
  • When you preview the form, you will see Sathiya as an hyperlink which upon clicking opens outlook with To address as Sathiya


Thats it!!!

Isn’t it much simpler? We are going to follow the same step when we need to add someone to CC, BCC just by replacing the address. Well, many of you may know how to change the email address for adding CC, BCC, subject and body, let me put them below to see everything at a single page.

To create email link with To and CC:

  • Replace the address as

To create email link with To, CC and BCC:

  • Replace the address as

To create email link with To and Subject:

  • related queries

To create email link with To, Subject, CC and BCC:

  • related queries&

To create email link with many persons in To & CC and with subject:


To create an email link with To, Subject, CC, BCC and body:

  •; you please answer the below queries

To create an email link with multiple lines in body:

  • Team, %0A Could you please clarify the below queries.

where %0A is linefeed (new line).

If you found it useful, please like and rate this!!

Radio Button in Infopath browser forms

I heard many times my client saying that they need only radio buttons in infopath and not the drop down because when the fields are created in SharePoint site and customized using infopath, they are automatically converted in to drop down.

Are you too encountering the same problem? Don’t worry. Follow the below steps to convert it to radio button.


To show you the steps, I have created a “Employee Info” list with below fields where Gender is selected as Radio button in choice type.


If New item is to be added, the below form will be opened:


This is the default form of SharePoint list. If you try to customize the look and feel of the list, using infopath, you will find that radio button is converted into drop down field as depicted below:


To make it as radio button, delete the field from the form view.

NOTE*: Do not delete the control permanently. Just delete it from the view.

In right corner of the infopath, you will see the list of fields with “Show advanced view” link. Click on the highlighted link. If you are not able to see the list of fields, click on the “DATA” menu -> Show Fields available under SharePoint Form Data section.


When you click on the field in advanced view, you will see a small inverted triangle. Click on the triangle and select Option button. Enter the number of choices to be inserted.

option button


Type the labels for inserted radio buttons and edit the values in Properties. That is, right click on the radio button, select Properties and type the value in “Value when selected”.


Alternative approach is to change the control to option button and perform a copy-paste for each choice. Finally, change the value of each choice as shown above in picture.

That’s it!!!

Make the form attractive and publish it.