Date validation:Selected date should be >5days excluding weekends

  • 8 October 2015
  • 2 replies
  • 33 views

Badge

Hello All,

 

I have a view in which i have a calendar control.User should be able to select a date which is greater than 5days excluding weekdays.
when the view gets initialized default date should be 5 days from todays date excluding todays date.
Format of the date should be only dd/mm/yyyy.

 

User should ot be allowed to select date less than current date and less than sla(i.e 5days from todays date excluding weekends).

Can some one help me on this.

Iam trying to find date difference and if it is <5 then thought to populate a message to select a date which is >5.But date difference doesnt give me positive results.

Date selected should be greater than 5days from todays date

 

 


2 replies

Badge +7

Hello,

 

So I have a couple things for you that I'll try to break down as well as I'm able. I think you may have to do a few things -- and I'm not sure if I'm overthinking this but it may help you come up with something even better!

 

Have you tried using an Expression within a Data Label and then do a validation check on the Data Label?

Here's what I have done. 

1. Created a SmartObject with a Date property

2. Created a View off the SmO

 

A) I have been able to create an Expression using the Logical If operator to achieve the following --

If the Date (taken from the Context of the SmO) is less than 5 days from Today, show 1 otherwise show 0.

I used the Add Days from the Date and Time operator in the Context Browser to add 5 days from Today (Today also comes from the Date and Time operator).

 

Here's an image below as a visual:

11865iD895208DCF0DE8B4.png

 

C) As a check, you can use an advanced condition in the Rules to check the data label expression in A) for the 1 or 0 and then show a message based on the results.

 

I hope this helps you get further along!

 

Regards,

Alyssa

Userlevel 1
Badge +8

Hi Jalligama

 

1. Add an expression to your view called "WeekDay" and use the Weekday function passing in your Calendar control

 

14949i9F53EEFEF816F21D.png

Reply