{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function send_event, post_event, msg, dialog_box, get_property\r\ndeclare subroutine end_dialog\r\n$insert msg_equates\r\n$insert rpt_cfg_equ\r\n\r\n\r\nNewReportID = .new_id->text\r\n\r\nIf NewReportID[-8,8] # '_SRPTCFG' Then\r\n   NewReportID := '_SRPTCFG'\r\nEnd\r\n\r\nopen 'CONFIG' to ConfigTable else\r\n   Void = msg( '', 'Unable to open CONFIG table' )\r\n   end_dialog( @window, NewReportID )\r\nend\r\n\r\nGoSub CheckRecordExists\r\n\r\nIf Ans Then GoSub WriteReportRecord\r\n\r\nreturn 0\r\n\r\n\r\n*===========================================\r\nCheckRecordExists:\r\n*===========================================\r\nAns = 1\r\nRead RptCfgRecd From ConfigTable, NewReportID Then\r\n   TmpStructure = ''\r\n   Msg001 = 'REPORT CONFIG RECORD ':NewReportID:' ALREADY EXISTS!|'\r\n   Msg001 = 'ARE YOU SURE YOU WANT TO OVERWRITE IT WITH THE CURRENT ONE?'\r\n   TmpStructure<MTEXT$> = Msg001\r\n   TmpStructure<MTYPE$> = 'BNYC'\r\n   TmpStructure<MMODAL$> = 'A'\r\n   TmpStructure<MICON$> = '!'\r\n   TmpStructure<MCAPTION$> = 'OVER WRITE??'\r\n   Ans = msg('', TmpStructure )\r\n   If Ans = 0 Or Ans = Char(27) Then\r\n      Ans = msg('', \"REPORT CONFIG RECORD COPY CANCELED!\" )\r\n      GoSub UnlockRecord\r\n      Ans = 0\r\n   End\r\nEnd\r\nReturn\r\n\r\n*===========================================\r\nWriteReportRecord:\r\n*===========================================\r\n   *Get the current report ID.\r\n   CurrReportID = get_property('REPORT_SLIST_CFG.REPORT_ID', 'TEXT')\r\n   *Read the report config record...\r\n   Read RptCfgRecd From ConfigTable, CurrReportID Else\r\n      Void = msg( '', 'Can Not read ':CurrReportID:' from CONFIG table' )\r\n      Void = post_event( @window:'.NEW_ID', 'GOTFOCUS' )\t   \r\n      return 0\r\n   End\r\n   LockID = NewReportID\r\n   GoSub LockRecord                                \r\n   write RptCfgRecd on ConfigTable, NewReportID else\r\n      Void = msg( '', 'Unable to write ':NewReportID:' to CONFIG table' )\r\n      Void = post_event( @window:'.NEW_ID', 'GOTFOCUS' )\t   \r\n      return 0\r\n   end\r\n   Ans = msg('', 'Record ':NewReportID:'  is written into CONFIG table' )\r\n   GoSub UnlockRecord\r\nReturn\r\n\r\n*===========================================\r\nLockRecord:\r\n*===========================================\r\nlock ConfigTable, LockID else\r\n   Void = msg( '', LockID:' is in use somewhere else. Can not write to it...' )\r\n   Void = post_event( @window:'.NEW_ID', 'GOTFOCUS' )\t   \r\n   return 0\r\nend\r\n\r\nReturn\r\n\r\n*===========================================\r\nUnlockRecord:\r\n*===========================================\r\nunlock ConfigTable, LockID else\r\n   Void = msg( '', 'Unable to unlock ':LockID:' in CONFIG table' )\r\nend\r\n\r\nReturn\r\n"
        }
    }
}