Find the previous working day by the passing the random date with specific calendarId

Hi Folks, Its just a mini logic which i thought to share for through this blog. Finding the previous working day by passing the calendarid and date into a custom method which is mentioned below.

WorkCalendardate   workCalendardate;

workCalendardate  =     TestConfirmWorkingDay::cmg_ConfirmWorkingDay(calendarID,date);
Create a method in a class or table level with below logic.

public WorkCalendardate TestConfirmWorkingDay(CalendarId _workParameters,date _keyDateResult)
{
  WorkCalendardate    workCalendarDate;
  
  select firstOnly CalendarId,TransDate,WorkTimeControl from workCalendarDate
  where workCalendarDate.CalendarId == _workParameters &&
  workCalendarDate.TransDate  == _keyDateResult;

  return workCalendarDate;

}
Thanks

No comments:

Post a Comment