* This function expects a From-Thru period and startdate and enddate (e.g. from the employee). * It'll tell you whether (e.g. the person is an employee) within or somewhere within the period. FUNCTION FoundInPeriod( tdFrom, tdThru, tdSdate, tdEdate ) * RETURN Empty( tdEdate ) and tdSdate <= tdThru ) ; or ; ( not Empty( tdEdate ) and ( Between( tdSdate, tdFrom, tdThru ) or Between( tdEdate, tdFrom, tdThru ) ) ) ; or ; ( not Empty( tdEdate ) and ( Between( tdFrom, tdSdate, tdEdate ) and Between( tdThru, tdSdate, tdEdate ) ) ) * if empty edate: * sdate ................................................................................ * | * no |--------------| * yes |--------------| * yes |--------------| * yes |--------------| * if filled edate: * sdate ..............................................edate * | | * no |--------------| * yes |--------------| * yes |--------------| * yes |--------------| * yes |--------------| * yes |--------------| * no |--------------| * yes |-------------------------------------------------------------------|