My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

04 April 2010

Incrementing Date in Repeating Table

by Patrik Luca 1 comments

Tag



Business Requirement: Incrementing Date in Repeating Table

The business requirement of this post covers the following topic: each time the user adds a line in a Repeating Table on an InfoPath form, the Date Field of the line should increment by one day automatically.

An example is elaborated in this post with the by default installed Expense Report Sample. Each time an Expense line is added, the Date of the Expense line will be incremented with one day.

Solution

  1. Add a new Date Field to the Data Source.


  2. Set the Default Value of the Date Field in the Repeating Table equal to the value of the previously added Date Field (LastAddedDate). Make sure you uncheck Update this value when the result of the formula is recalculated.

     
  3. Add a Rule to the Repeating Table which adds a day to the LastAddedDate Field (Use the function addDays for it).


  4. Add a second Rule to the Repeating Table which sets the value of Date Field of the Repeating Table equal to the LastAddedDate Field.

     
  5. Add a Rule to the Date Field in the Repeating Table which sets the value of the LastAddedDate Field equal to the value of the Date Field in the Repeating Table.


Result: Date Field in Repeating Table gets default value

If you enter as Date 4/04/2010 for the first Expense line, the Date will be automatically set to 5/04/2010 on the second added Expense line and so on. If you enter as Date 10/4/2010 for the third added Expense line, the adding of Dates will go further from April the 10th for Expense lines added afterwards.

Comments 1 comments
Anonymous said...

Sorry it is not working with my infopath 2010, can u possibly send me the code to have a look please?

manglai658@hotmail.com

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Blog Archive

My Blog List

Followers

Links