Dear all,
I have the following Pseudo code and my questions are include in the remark: 'how to write this? and RED in color
Sorry for not be able to ask my questions clearly and thank you for your help in advance.
Code:public function fn_matched_date(p_hit_weekday as string, _ p_control_Date as date, p_Input_Date as date) as date Dim isExist as boolean 'p_Hit_Weekday=2,6 'Wednesday and Friday 'p_control_Date=#01-Jul-2009# 'p_Input_Date=#21-Apr-2009# while p_input_date <= p_control_Date if p_input_date is in (p_hit_weekday) then 'How to write this? 'Check if p_input_date is Wed or friday which are the values in the variable p_Hit_weekday isExist = fn_Date_Exist(p_input_date) 'Check if this date exists in a database table by an existing function: fn_date_exists else p_input_date=add to the next nearest hit weekday 'How to write this? '1st e.g. if p_input_date is thursday, it need to add one date so that it will become friday '2nd e.g. if p_input_date is monday, it need to add two dates so that it will become Wednesday '3rd e.g. if the variable p_hit_weeday is having the values: 3,4 , and if p_input_date is monday, it need to add three dates so that it will become Thursday isExist = fn_Date_Exist(p_input_date) end if if isExist then fn_matched_date = p_input_date exist the while loop else p_input_date=add to the next nearest hit weekday 'to continue the looping until it find the matched date end if wend if not isExist then fn_matched_date = #31/12/1899# end if ' return an invalid date in case it cannot find the matched date End function





Reply With Quote