Hello,
I am trying to use the Error message tool in conjunction with Interface tools to have it return an error message when they select a date outside of a time frame for the Start Date. That time frame is no earlier than the 1st of the year 3 years prior. So currently that would be 1-1-2022, but next year it will be 1-1-2023 and so forth each year, so it can't be a set date. The SQL query is set to restrict the data from not going back further, but they will need to be able to select date ranges within that time frame. I've used this tool before, but with a set date so it was easier.
Screenshots of the Error message tool (current expression works only during 2025), Interface tools, and SQL query portion that restricts data as reference below.
Thank you,
Kim
Solved! Go to Solution.
@kas if the limitation is coming in the query and is not getting affected by the user's selection, is the goal just to have your Error Message expression be dynamic to the past three years of dates so they know they won't get older data? i.e. they can't select a start date greater than three years old?
Yes, so if they select an older date than what the query is pulling, they will receive the error message.
Cool, then this worked for me: [#1]<DateTimeParse(ToString(DateTimeYear(DateTimeToday())-3)+"-01-01", "%Y-%m-%d")
Happy to help!
Hello again!
Hope you can help again...I'm looking to have the error pop up when the date is more than 6 months from the current date. (easy for me to adjust the years with your solution, but not sure how to adjust for months)
Thank you!
Kim
Look at using similar logic but using a DateTimeAdd function to add 6 months from the current date!
I had tried something like that, but I am uncertain of how to write it correctly, I get syntax errors.
What have you tried? Should just be [#1]>DateTimeAdd(DateTimeToday(),6,'months')