Question:
I have created two parameters in my report - "Start Date" and "End Date".
The values for these parameters is provided by the user at the time of report execution.
How do I set a validation that ensures the difference between "Start Date" and "End Date" is not greater than 3 months?
Answer:
Logi Report offers a parameter validation feature via a special property:
On Parameter Value Change |
Specifies to define an action that will be called when the parameter value changes. Choose a formula from the drop-down list to develop an action, which will be called before the other actions defined in the report or library component. It can work as a parameter value validation rule. |
This property is available on the Parameter itself or on the Report template.
For this case, you can create a formula named f_validation, with the following expression:
if(DateDiff("M", @pStartDate, @pEndDate) > 3)
return "Start date and end date can't exceed 3 months!"
else
return "";
Then assign the formula f_validation to property "On Parameter Value Change" either on parameter @pStartDate or @pEndDate, or on the Report template.
Run the report and you will get the notification message if the start date and end date exceed 3 months.
Comments
2 comments
This is helpful. How can we also have sequence of dates correct in the same formula ?
Like not allowing below date sequence
Start date 15th Dec 2020
End date 15th Nov 2020
Thanks for the comments. Actually the formula function DateDiff(intervalType, startDateTime, endDateTime) already validates the sequence. If the endDateTime variable is smaller, than the function will return negative number instead of positive number.
Please sign in to leave a comment.