Hi,
worday function is used when weekends are need to be excluded to calculate workdays. We have requirement to calculate including weekend. Below is our expression we need help to calculate finaldate when include weekend is true. here expectedholidays is list of holidays.
a!localVariables( local!expectedDays: if(ri!days > 0, ri!days, 0), local!exceptedHolidays: if(isnull(ri!holidays), {}, ri!holidays), local!startDate: today() - 1, local!initialEndDate: local!startDate + local!expectedDays, local!FinalEndDate: a!forEach( items: enumerate(local!expectedDays)+2, expression: if( contains(local!exceptedHolidays,local!FinalEndDate), local!initialEndDate+1, local!initialEndDate ) ), local!exceptedDeadline: if( ri!days > 0, if( ri!excludeWeekends, workday( today() - 1, local!expectedDays, local!exceptedHolidays ), local!FinalEndDate ), cons!CORE_MAX_DATE ), local!exceptedDeadline )
Discussion posts and replies are publicly visible
This is confusing ?!?!
And the lines 5-13 are nonsense. As Appian expressions follow a functional paradigm, local variables are immutable and cannot be changed in a foreach.