Repeating Table Date Field Validation - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Repeating Table Date Field Validation

Last post 10-04-2011 09:57 AM by cashworth. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-20-2011 03:13 PM

    Repeating Table Date Field Validation

     Hi,

    I'm working on a project that requires me to have a repeating table with two date pickers: StartDate and EndDate. I was wondering how I would go about ensuring that the dates entered aren't within the range of the other date ranges on the form. As far as the logic is concerned I believe I need the condition to go off when StartDate <= OtherInstancesEndDate AND EndDate >= OtherInstancesStartDate.

    I've read posts about using preceding-sibling, but when I tried I could only ever make it check with one of the other siblings, but it needs to check against all of them. Please let me know if you have any ideas.

    Thanks,

    Colin

  • 09-20-2011 11:47 PM In reply to

    Re: Repeating Table Date Field Validation

    Hi Cashworth,

    This is an interesting question. Here's a simple idea: change the UI to force the user to add a row at the bottom. After added, it gets automatically inserted and sorted in ascending order of the StartDate in a read only table above it. Now, you can use preceding-sibling and the rarer follow-sibling to compare it. Just add a hidden column to your table with a default value that computes based on the preceding and following and then add a conditional formatting rule to the row that invalidates based on this hidden column being non-blank. Then, change the area below to point to this item (as opposed to the last row). In other words, you don't allow another row until they fix it.

    A bit tricky, but definitely doable. :)

    Patrick Halstead
    Project Manager at Qdabra
  • 09-21-2011 11:32 AM In reply to

    Re: Repeating Table Date Field Validation

    Here is something I threw together that works and suits your needs from what I can tell.

    What it does is converts each date to a number. From there I store the max start date and min end Date in fields outside of the table. I left all of those numbers visible in case you need to change anything. All you would need to do is copy over those equations and replace them with your fields.

    I really hope this helps!! Let me know if you have any questions.

    Edit: Theres a bunch of rules and conditions on data validation so make sure you look for all of those.

  • 09-21-2011 05:32 PM In reply to

    Re: Repeating Table Date Field Validation

     Thank you both for your replies! I've been assigned to a higher priority task for the time being, but when I get back to working on this I'll definitely try out your suggestions. I'll let you know how it turns out.

    Thanks again! :D

    Colin

  • 10-04-2011 09:57 AM In reply to

    Re: Repeating Table Date Field Validation

    Hi guys,

    Thanks again for your replies. When I came back to this problem, I realized that I gave some inaccurate information. I meant to say repeating section not table. Either way, I managed to make it work using code behind.

    Thanks,

    Colin

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.