Skip to main content

I've always struggled working with dates. And here comes this one, if someone can help with this, that would be great.

I've got a repeating section on a form (not linked to a Multiple line of text /xml or anything). I need to place a validation rule on that date to error out if that date value is not within 30 days of the report date (which is by default is the current date). So first I need to identify the limit of the 30 days of the report date and then compare to see that any date that is within that repeating section is before those 30 days limit. Example:

Report date: October 1, 2017. repeating section date is Aug 1, 2017. The form should error because the 30 day lmit should be till only sep 1, 2017 (so mainly 30 days before the report date). 

We need it to validate before it is saved and provides a message to the user to say which date that is not falling within the 30 days limit. The repeating section can grow so big, so I need to be able to pinpoint to the user which date exactly is invalid.

So basically it has to be through regex, validation rule, expression.. anything but not a workflow, because the user is not allowed to save unless all dates are fixed.

Thanks!

I feel like this is going to be a struggle. No so much the validation, but pinpointing which specific repeating section item errored. 


If anyone knows, it's probably


May be i am missing something , but from what i read it seems to be a pretty straightforward requirement !!

My understanding :

1] Two fields in the repeating section ( Report date and Other date field)

2] Report date default's to the current date

3] Validate the Other field to be within 30 days of Report Date.

If you want to achieve this then simply add a rule on the Other Date field,

greaterThan(Other DateReport Date) || dateDiffDays(Other DateReport Date) > 30

0Note: Other Date and Report Date are the Name controls]

Result :


The report date won't be in each repeating item section, though - she'd be referencing from the header date. I know she can pull that in and make it invisible, but I've had issues trying to reference invisible calcs in repeating sections before. Just me?


By header date , you mean a single Report Date field at the top followed by the Repeating Section (which has the Other Date field).

Something similar to :

Even in that case, the rule will work as expected , just need to place the Report Date outside the repeating section.


Well, that's awesome! Thank you


Thank you so much ‌. That worked perfectly. 

Thanks ‌ for following up and reading my mind happy.png 


Reply