{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare subroutine forward_event, rlist, Send_Event, Set_Property\r\ndeclare function get_eventstatus, msg, fieldcount, obj_ICAR\r\n$insert logical\r\n$insert msg_equates\r\n$insert rlist_equates\r\n\r\nforward_event( Flag, FocusID )\r\nError = get_eventstatus()\r\nif Error else\r\n\tOrigTablename = get_property( @window, '@Tablename' )\r\n\tTable = .exporttablenames->text\r\n\t\r\n\tIF Table = 'ICAR' THEN\r\n\t\tIF NOT(obj_ICAR('RespSup')) THEN\r\n\t\t\tSet_Property(@WINDOW,'SAVEWARN',0)\r\n\t\t\tSend_Event(@WINDOW,'CLEAR')\r\n\t\t\tRETURN 0\r\n\t\tEND\r\n\tEND\r\n\t\r\n\tif Table <> OrigTablename then\r\n\t    ExpInfo = .export_info->array\r\n\t    convert @vm:@fm to '' in ExpInfo\r\n\t    Continue = true$\r\n\t    if ExpInfo then\r\n    \t    * warning is data in export info or query will be overwritten\r\n    \t    MsgInfo = ''\r\n    \t    Ttext = 'You have changed the Tablename from ':OrigTableName:' to ':Table:' and there is currently export fields defined for ':OrigTableName:'.  Continuing will clear out and remove all export fields and query information.  Do you wish to continue?'\r\n    \t    MsgInfo<mtext$> = Ttext\r\n    \t    MsgInfo<micon$> = '?'\r\n    \t    MsgInfo<mtype$> = 'BNY'\r\n    \t    Continue = msg( '', MsgInfo )\r\n    \tend\r\n\t    if continue then\r\n\t        Void = utility( 'CURSOR', 'H' )\r\n\t        Array = str( @vm, 9 )\r\n\t        .export_info->array = Array\r\n\t        DictTable = 'DICT.':Table\r\n\t        Cmd = \"SELECT \":DictTable:\" BY @ID WITH F1 = 'F' 'S'\"\r\n\t        rlist( Cmd, target_activelist$, '', '', '' )\r\n\t        Columns = ''\r\n\t        if @reccount then\r\n\t            Eof = false$\r\n\t            loop\r\n\t                readnext DictId else Eof = true$\r\n\t              until Eof\r\n\t                Columns := DictId:@vm\r\n\t            repeat\r\n\t            Columns[-1,1] = ''\r\n\t            Void = set_property( @window, '@Columns', Columns )\r\n\t        end else\r\n\t            Void = msg( '', 'Error while selecting columns from ':DictTable )\r\n\t            return 0\r\n\t        end\r\n   \t        Cmd = \"SELECT \":DictTable:\" USING EXPORTS BY @ID WITH F6 = 1\"\r\n\t        rlist( Cmd, target_activelist$, '', '', '' )\r\n\t        BtreeColumns = ''\r\n\t        if @reccount then\r\n\t            Eof = false$\r\n\t            loop\r\n\t                readnext DictId else Eof = true$\r\n\t              until Eof\r\n\t                BtreeColumns := DictId:@vm\r\n\t            repeat\r\n\t            BtreeColumns[-1,1] = ''\r\n\t            Void = set_property( @window, '@BtreeColumns', BtreeColumns )\r\n\t            Array = str( @vm, 9 ):@fm:str( @vm, 9 )\r\n\t            .query_info->array = Array\r\n\t        end else\r\n\t            * no btree columns\r\n\t        end\r\n\t        Void = utility( 'CURSOR', 'A' )\t        \r\n        end else\r\n            .exporttablenames->text = OrigTablename\r\n        end\r\n        QColumns = Columns\r\n        BcCnt = fieldcount( BtreeColumns, @vm )\r\n        for i = 1 to BcCnt\r\n            locate BtreeColumns<1,i> in QColumns using @vm setting Rpos then\r\n                QColumns = delete( QColumns, 1, Rpos, 0 )\r\n            end\r\n        next i\r\n        Void = set_property( @window, '@QColumns', QColumns )\r\n\tend\r\nend\r\nRETURN 0"
        }
    }
}