Ritesh_Garg
asked on
Bank Holiday Check
I am trying to populate a field called RF_BANK_DATE which is derived element and the business what this field to be populated based on RF_Post_date..(please review the below)
However there is an issue with the below logic if the RF_Post_Date happens to on a Friday then we are going to set RF_Bank_Date to either Saturday/Sunday or if it posted on a working day then if the following day is a bank holiday then the RF_BANK_DATE is not valid because there will not any exchange of funds on a sat or Sunday or on a holiday.
So I have to modify the logic so that I can exclude Bank Holidays ? How do I do that ? Please help me ASAP
DBMS NAME - Sybase Adaptive Server Anywhere
DBMS Version- 12.70
Update itsrf
SET RF_Bank_dt =
CASE
WHEN Home_Host_Code = 'Home' AND itsrf.RF_Post_Date = today()-1 THEN itsrf.RF_Post_Date + 2
WHEN Home_Host_Code = 'Home' AND itsrf.RF_Post_Date = today() THEN itsrf.RF_Post_Date + 1
WHEN Home_Host_Code = 'Host' AND itsrf.ITS_Central_Financia l_Agency_D isp_Date = today()-1 THEN
itsrf.ITS_Central_Financia l_Agency_D isp_Date + 2
WHEN Home_Host_Code = 'Host' AND itsrf.ITS_Central_Financia l_Agency_D isp_Date = today() THEN
itsrf.ITS_Central_Financia l_Agency_D isp_Date + 1
ELSE '1800-01-01'
END
Thank you,
However there is an issue with the below logic if the RF_Post_Date happens to on a Friday then we are going to set RF_Bank_Date to either Saturday/Sunday or if it posted on a working day then if the following day is a bank holiday then the RF_BANK_DATE is not valid because there will not any exchange of funds on a sat or Sunday or on a holiday.
So I have to modify the logic so that I can exclude Bank Holidays ? How do I do that ? Please help me ASAP
DBMS NAME - Sybase Adaptive Server Anywhere
DBMS Version- 12.70
Update itsrf
SET RF_Bank_dt =
CASE
WHEN Home_Host_Code = 'Home' AND itsrf.RF_Post_Date = today()-1 THEN itsrf.RF_Post_Date + 2
WHEN Home_Host_Code = 'Home' AND itsrf.RF_Post_Date = today() THEN itsrf.RF_Post_Date + 1
WHEN Home_Host_Code = 'Host' AND itsrf.ITS_Central_Financia
itsrf.ITS_Central_Financia
WHEN Home_Host_Code = 'Host' AND itsrf.ITS_Central_Financia
itsrf.ITS_Central_Financia
ELSE '1800-01-01'
END
Thank you,
I've only seen bank holidays handled ad-hoc for each state or province. You can have a table just of bank holidays, or a table of all days in the year, with a flag for which days are business/bank days and which are not. The SQL expressions become pretty simple then.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Holidays was handled in independent functions.
Open in new window