{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare subroutine btree.extract, update_index, rlist, end_dialog\r\ndeclare function msg, key_sort, utility, ex_vm_rem\r\n$insert lsl_users_equ\r\n$insert msg_equates\r\n\r\nopen 'DICT.SUB_REC_LOG' to DictSubRecLogTable else\r\n   Void = msg( '', 'Unable to open DICT.SUB_REC_LOG...' )\r\n   return 0\r\nend\r\n\r\nSearchStr   = ''\r\nDateFrom    = .date_from->text\r\nDateThru    = .date_thru->text\r\nSRLVendor   = ex_vm_rem( .SubrecLogVendor->text )\r\nconvert @fm to @vm in SRLVendor; *text property will be fm delimited if >1 chosen\r\nCustomerIDs = ex_vm_rem( .customer_info->array<1> ) \r\nReceiverIDs = ex_vm_rem( .receivers->array<1> )\r\n\r\nswap @vm:@vm with '' in CustomerIDs\r\nif CustomerIDs[-1,1] = @vm then CustomerIDs[-1,1] = ''\r\nif CustomerIDs then\r\n    SearchStr<-1> = 'CUST_ID':@vm:CustomerIDs\r\nend\r\n\r\nswap @vm:@vm with '' in ReceiverIDs\r\nif ReceiverIDs[-1,1] = @vm then ReceiverIDs[-1,1] = ''\r\nif ReceiverIDs then\r\n    SearchStr<-1> = 'RECEIVER_SIG':@vm:ReceiverIDs\r\nend\r\n\r\nif DateFrom and DateThru then\r\n    SearchStr<-1> = 'DATE_REC':@vm:DateFrom:'...':DateThru\r\nend else\r\n\tif DateFrom then\r\n\t    SearchStr<-1> = 'DATE_REC':@vm:'>=':DateFrom\r\n\tend\r\n\tif DateThru then\r\n\t    SearchStr<-1> = 'DATE_REC':@vm:'<=':DateThru\r\n\tend\r\nend\r\n\r\nif SRLVendor then\r\n\tSearchStr<-1> = 'VENDOR':@vm:SRLVendor\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, 'SUB_REC_LOG', DictSubRecLogTable, Keys, '', Flag )\r\n    if Flag <> 0 then\r\n       Void = msg( '', 'Error while extracting Substrate Receiving Log 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, 'SUB_REC_LOG', '#DATE_REC':@fm:'#TIME_REC', 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\r\n"
        }
    }
}