Hello,
i have a date field and i would like to have a check box checked if the date inserted in the date field is <3 moths from today
how to do this
Thanks
Solved! Go to Solution.
Hi,
Have a look at this form, https://sites.google.com/site/livecycledesignercookbooks/home/Bassel.pdf?attredirects=0&d=1
Is there any specific errors you were getting?
I was not sure how you wanted to handle the days of the months, so the method above ignores the days and just compares the months. But you could easily extend this approach if needed.
Regards
Bruce
Hi,
You could use something like the following FormCalc in the calculate event of the checkbox;
if (HasValue(DateField1)) then
var monthsNow = Format("MM", Num2Date(Date(), "YYYY-MM-DD")) + Format("YYYY", Num2Date(Date(), "YYYY-MM-DD")) * 12
var monthsInput = Format("MM", DateField1) + Format("YYYY", DateField1) * 12
if (monthsNow - monthsInput > 3) then
1
else
0
endif
endif
This just calculates the number of months since Jan 1900 for the current date and for the value entered into the date field DateField1.
Regards
Bruce
Views
Replies
Total Likes
Hello Bruce
Thanks for your help
unfortunately it didn't work
can you send me the form you created using this formula
Again, appreciate your help
Thanks
Views
Replies
Total Likes
Hi,
Have a look at this form, https://sites.google.com/site/livecycledesignercookbooks/home/Bassel.pdf?attredirects=0&d=1
Is there any specific errors you were getting?
I was not sure how you wanted to handle the days of the months, so the method above ignores the days and just compares the months. But you could easily extend this approach if needed.
Regards
Bruce
got it,
Thanks buddy
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies