I'm working on a test case in Tricentis Tosca where I need to input a date from the previous month, but it has to be a business day (Monday to Friday). I know how to subtract a month using DATEADD, but I'm unsure how to ensure the selected date falls on a business day.
Is there a built-in function in Tosca to determine weekdays, or will I need to implement a custom solution? If a custom solution is needed, could you suggest the best approach to do this in Tosca?
Ideally, I’m looking for a solution within Tosca that can directly identify and select a business day. If that's not possible, I'm open to suggestions for implementing a custom solution that's reliable and easy to maintain.
You should be able to use the w
suffix (for workdays) in the built-in date-functions to define offsets in working days (which also takes into account user-defined holidays). See also in Calculating and formatting date and time values.
In other words, to get the next working day after today, use:
{DATE[][+1w][]}
Or if you want a business day in the previous month:
{DATE[][-1M+1w][]}
NOTE: I currently don't have access to Tosca, so I can't actually verify if this works (I might have missed some subtlety of the syntax).