Skip to main content
April 26, 2023
Question

Date Range validation

  • April 26, 2023
  • 4 replies
  • 1 view

Hi ,

I have a list of dictionaries with date ranges(refer below screenshot)

i need validation that if i give a date and if the given date is overlapped with any of the dates(start and end date) i should get a validation. 

for example;

start date : 05/10/2023

end date : 05/15/2023

i'm comapring the given date in this date range for each dictionary for that it is working fine but if i select date between 05/09/2023 and 05/16/2023 i should get validation that is not working,and there are many dictionaries like this.  Cany anyone help me how to do this?

4 replies

stefanhelzle0001
April 26, 2023

Ready to help. Can you share your existing code?

stefanhelzle0001
April 26, 2023

Operators in Appian can easily compare a value against a list of values. Depending on your exact requirement, this should be pretty simple.

a!localVariables(
  local!ranges: {
    a!map(start: date(2023, 1, 1), end: date(2023, 2, 1)),
    a!map(start: date(2023, 2, 1), end: date(2023, 3, 1)),
  },
  local!date: date(2023, 1, 15),
  {
    local!date >= local!ranges.start,
    local!date <= local!ranges.end
  }
)

April 26, 2023

Hi Stefan,

In simple terms employee is applying for leave and if user want to apply for new leave or edit applied leave there should not be overlapping between existing leaves applied.

I just have UI with start date and end date, once user submits the form data is stored in database. while changing the dates in  the ui again there should not be overlap.