{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare subroutine btree.extract, update_index, rlist, end_dialog\r\ndeclare function msg, key_sort, utility, fieldcount\r\n$insert lsl_users_equ\r\n$insert msg_equates\r\n\r\n\r\nopen 'DICT.QUARTZ_WAND_LOG' to DictQuartzWandLogTable else\r\n   Void = msg( '', 'Unable to open DICT.QUARTZ_WAND_LOG...' )\r\n   return 0\r\nend\r\nSearchStr = ''\r\nEntryDateFrom = .entry_date_from->text\r\nEntryDateThru = .entry_date_thru->text\r\n\r\nReactors      = .reactors->array\r\nswap @vm:@vm with '' in Reactors\r\nif Reactors[-1,1] = @vm then Reactors[-1,1] = ''\r\n\r\nif EntryDateFrom and EntryDateThru then\r\n    SearchStr<-1> = 'ENTRY_DATE':@vm:EntryDateFrom:'...':EntryDateThru\r\nend else\r\n\tif EntryDateFrom then\r\n\t    SearchStr<-1> = 'ENTRY_DATE':@vm:'>=':EntryDateFrom\r\n\tend\r\n\tif EntryDateThru then\r\n\t    SearchStr<-1> = 'ENTRY_DATE':@vm:'<=':EntryDateThru\r\n\tend\r\nend\r\nif Reactors <> '' then\r\n    SearchStr<-1> = 'REACTOR':@vm:Reactors\r\nend\r\n\r\nEntryIds      = .entry_ids->array<1>\r\nReactItems    = .react_items->array<1>\r\nReactServs    = .react_servs->array<1>\r\nReactors      = .reactors->array\r\nRProbsCat     = .react_probs_cat->array<1>\r\nRServsCat     = .react_servs_cat->array<1>\r\n\r\nswap @vm:@vm with '' in RProbsCat\r\nif RProbsCat[-1,1] = @vm then RProbsCat[-1,1] = ''\r\nswap @vm:@vm with '' in RServsCat\r\nif RServsCat[-1,1] = @vm then RServsCat[-1,1] = ''\r\nswap @vm:@vm with '' in EntryIds\r\nif EntryIds[-1,1] = @vm then EntryIds[-1,1] = ''\r\nswap @vm:@vm with '' in Reactors\r\nif Reactors[-1,1] = @vm then Reactors[-1,1] = ''\r\nswap @vm:@vm with '' in ReactItems\r\nif ReactItems[-1,1] = @vm then ReactItems[-1,1] = ''\r\nswap @vm:@vm with '' in ReactServs\r\nif ReactServs[-1,1] = @vm then ReactServs[-1,1] = ''\r\n\r\nif EntryIds <> '' then\r\n    SearchStr<-1> = 'ENTRY_ID':@vm:EntryIds\r\nend\r\nif ReactItems <> '' then\r\n    SearchStr<-1> = 'REACT_ITEM_ID':@vm:ReactItems\r\nend\r\nif ReactServs <> '' then\r\n    SearchStr<-1> = 'REACT_SERV_ID':@vm:ReactServs\r\nend\r\nif RProbsCat <> '' then\r\n    SearchStr<-1> = 'REACT_PROB_CAT_ID':@vm:RProbsCat\r\nend\r\nif RServsCat <> '' then\r\n    SearchStr<-1> = 'REACT_SERV_CAT_ID':@vm:RServsCat\r\nend\r\n*\r\nCatVar = ''\r\n*if Maint then\r\n*    CatVar<1,-1> = 'M'\r\n*end\r\n*if Pass then\r\n*    CatVar<1,-1> = 'A'\r\n*end\r\n*if CatVar then\r\n*   SearchStr<-1> = 'CATEGORY':@vm:CatVar\r\n*end\r\nif Reactors <> '' then\r\n    SearchStr<-1> = 'REACTOR':@vm:Reactors\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, 'QUARTZ_WAND_LOG', DictQuartzWandLogTable, Keys, '', Flag )\r\n    if Flag <> 0 then\r\n       Void = msg( '', 'Error while extracting QUARTZ_WAND_LOG records...' )\r\n       return 0\r\n    end\r\n    if Keys then\r\n       convert @vm to @fm in Keys\r\n       * RESORT THIS MESS ACCORDING TO MIKE\r\n       ** Keys = key_sort( Keys, 'REACTOR_LOG', 'REACTOR':@fm:'REACT_PROB_CAT_DESC_INITIAL':@fm:'START_DATE', 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"
        }
    }
}