{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare subroutine btree.extract, update_index, rlist, end_dialog\r\ndeclare function msg, key_sort, utility\r\n$insert lsl_users_equ\r\n$insert msg_equates\r\n\r\nopen 'DICT.ATTENDANCE' to DictATTENDANCETable else\r\n   Void = msg( '', 'Unable to open DICT.ATTENDANCE...' )\r\n   return 0\r\nend\r\nSearchStr     = ''\r\nATTENDANCEDateFrom   = .attendance_date_from->text\r\nATTENDANCEDateThru   = .attendance_date_thru->text\r\nEmployeeIds    = .employee_info->array<1>\r\nSupervisorIds  = .supervisor_info->array<1>\r\nShifts        = .shift->text\r\n* need to convert field to value markers as the text property will \r\n* be field mark delimited if more than one is choosen\r\nconvert @fm to @vm in Shifts\r\n\r\nswap @vm:@vm with '' in EmployeeIds\r\nif EmployeeIds[-1,1] = @vm then EmployeeIds[-1,1] = ''\r\nswap @vm:@vm with '' in SupervisorIds\r\nif SupervisorIds [-1,1] = @vm then SupervisorIds [-1,1] = ''\r\nif EmployeeIds then\r\n    SearchStr<-1> = 'EMPLOYEE':@vm:EmployeeIds\r\nend\r\nif SupervisorIds then\r\n    SearchStr<-1> = 'SUPERVISOR':@vm:SupervisorIds\r\nend\r\n\r\nif ATTENDANCEDateFrom and ATTENDANCEDateThru then\r\n    SearchStr<-1> = 'DATE_ABSENT':@vm:ATTENDANCEDateFrom:'...':ATTENDANCEDateThru\r\nend else\r\n\tif ATTENDANCEDateFrom then\r\n\t    SearchStr<-1> = 'DATE_ABSENT':@vm:'>=':ATTENDANCEDateFrom\r\n\tend\r\n\tif ATTENDANCEDateThru then\r\n\t    SearchStr<-1> = 'DATE_ABSENT':@vm:'<=':ATTENDANCEDateThru\r\n\tend \r\nend\r\n\r\n* Shifts\r\nif Shifts <> '' then\r\n   SearchStr<-1> = 'SHIFT':@vm:Shifts\r\nend\r\n\r\nif SearchStr then\r\n    SearchStr := @fm\r\n    Void = utility( 'CURSOR', 'H' )\r\n    * do a btree.extract\r\n    btree.extract( SearchStr, 'ATTENDANCE', DictATTENDANCETable, Keys, '', Flag )\r\n    if Flag <> 0 then\r\n       Void = msg( '', 'Error while extracting ATTENDANCE records...' )\r\n       return 0\r\n    end\r\n    if Keys then\r\n       convert @vm to @fm in Keys\r\n       Keys = key_sort( Keys, 'ATTENDANCE', '#DATE_ABSENT', 1 )\r\n       end_dialog( @window, Keys )\r\n    end else\r\n       MsgInfo = ''\r\n       MsgInfo<mtext$> = 'No records found meeting your criteria...' \r\n       MsgInfo<micon$> = '!'\r\n       Void = msg( '', MsgInfo )\r\n    end\r\n    Void = utility( 'CURSOR', 'A' )\r\nend else\r\n    MsgInfo = ''\r\n    MsgInfo<mtext$> = 'You have not entered any search criteria...' \r\n    MsgInfo<micon$> = '!'\r\n    Void = msg( '', MsgInfo )\r\nend\r\nreturn 0\r\n"
        }
    }
}