InfoPath rule based repeating section date validation
A question was asked in the SharePoint 2010 Infopath forums:
"I am using Infopath2010 and developing a form where there are multiple sections. In each section I have a from date and to date controls.My requirement is to takecare the same date range should not fall in anyother sections."
I went crazy and decided to took on the challenge, I started with 2 tips:
- The Infopath codeless programmer - how to do DateDiff with Infopath rules.
http://alecpojidaev.wordpress.com/2008/12/30/infopath-codeless-programming-walkthrough-2/ - How to use Preceding:: to check previous repeating sections
/blog/2011/3/24/infopath-using-preceding-xpath-expression-to-hide-repeating.html
The result:
The XSN template is here:
Summary Steps
- Use DateDiff - calculate date difference between Begin & Epoch
- Again for End & Epoch
- Use Preceding rule to calculate max date difference in previous "End From Epoch"
- Validation rules kick off when datediff for the current section is less than the max from previous section
Have fun!