Quick Tip: Select the latest date from a repeating table in InfoPath

by S.Y.M. Wong-A-Ton

Learn how you can use the max() function in a formula and conditional formatting in InfoPath to select and/or highlight the latest (newest) date in a repeating table.

In a recent article, I showed you how you can use the min() function, a hidden field, and formulas in InfoPath to select and display the oldest date that was selected from a date picker control in a repeating table.

You can easily change this solution to select and display the latest (newest) date that was selected from a date picker control in a repeating table.

All you would have to do is:

  1. Rename the minDate field to maxDate (just to keep things nice and tidy).
  2. Change the formula in step 13 of Selecting the minimum date in an InfoPath repeating table using formulas (no code) to:

    ../my:group1/my:group2/my:field1[../my:field2 = xdMath:Max(/my:myFields/my:group1/my:group2/my:field2)]

Extra tip:
The value of the latest date is stored in the maxDate field, so if your InfoPath form solution requires you to use this date elsewhere in the form, you can grab the value stored in maxDate.

And as mentioned in my previous article, this solution also works for browser-enabled InfoPath forms.

 Subscribe (RSS | Email)

Related Posts

Comments to this post were closed 30 days after it was published.

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. Usage of techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.

Working with InfoPath