// Use SortUtil.vw // Activate_SortUtil_Vw (for use in the DFMatrix environment) Use SortUtil.pkg // UI bricks for reindexing a set of tables Use Spec0011.utl // Floating menues on the fly Use API_Attr.utl // Functions for querying API attributes Use Files.utl // Utilities for handling file related stuff /SortUtil.Vw.Intro $Title$ Reindexing of tables With this utility you may reindex tables /* #IFDEF IS$WINDOWS activate_view Activate_SortUtil_Vw for oSortUtil_Vw object oSortUtil_Vw is a aps.View label "Reindexing of tables" on_key KCANCEL send close_panel object oLst is a cSortUtilList set size to 225 0 register_object oTotal procedure update_total integer iItemsInList set value of (oTotal(self)) to (string(iItemsInList)+" tables") end_procedure end_object object oTotal is a aps.TextBox label "" snap SL_DOWN set fixed_size to 12 60 set justification_mode to JMODE_LEFT end_object send update_total to (oLst(self)) 0 procedure DoSortTables send DoSort to (oLst(self)) end_procedure procedure DoGetTablesSelector_Help integer iFile integer iSelected integer iShaded local string sRoot get API_AttrValue_FILELIST DF_FILE_ROOT_NAME iFile to sRoot send SU_Add_Rootname sRoot end_procedure procedure DoGetTablesSelector send cursor_wait to (cursor_control(self)) send DFMatrix_CallBack_Selected_Files msg_DoGetTablesSelector_Help self 1 0 1 send fill_list to (oLst(self)) send cursor_ready to (cursor_control(self)) end_procedure procedure DoGetTablesDirectories local string sDir get SEQ_SelectDirectory "Select directory structure" to sDir if sDir ne "" begin send cursor_wait to (cursor_control(self)) send SU_Add_RootNamesInDirectories sDir send fill_list to (oLst(self)) send cursor_ready to (cursor_control(self)) end end_procedure procedure DoGetTablesDirectory local string sDir get SEQ_SelectDirectory "Select directory" to sDir if sDir ne "" begin send cursor_wait to (cursor_control(self)) send SU_Add_RootNamesInDirectory sDir send fill_list to (oLst(self)) send cursor_ready to (cursor_control(self)) end end_procedure procedure DoGetTablesAllWS string sDir send cursor_wait to (cursor_control(self)) get_profile_string "defaults" "VDFRootDir" to sDir send SU_Add_RootNamesInAllWS send SU_Add_RootNamesInDirectories sDir send fill_list to (oLst(self)) send cursor_ready to (cursor_control(self)) end_procedure procedure DoGetTableBrowse local string sRoot get SEQ_SelectInFile "Select data file" "DAT files|*.dat" to sRoot if sRoot ne "" begin send SU_Add_Rootname sRoot send fill_list to (oLst(self)) end end_procedure procedure DoProperties send DoProperties to (oLst(self)) end_procedure procedure DoReset send reset to (oLst(self)) end_procedure object oBtn1 is a aps.Multi_Button procedure PopupFM send FLOATMENU_PrepareAddItem msg_DoGetTablesSelector "Get tables from table selector" send FLOATMENU_PrepareAddItem msg_DoGetTableBrowse "Browse for one table" send FLOATMENU_PrepareAddItem msg_DoGetTablesDirectory "Get all tables in folder" send FLOATMENU_PrepareAddItem msg_DoGetTablesDirectories "Get all tables in folder and below" send FLOATMENU_PrepareAddItem msg_DoGetTablesAllWS "Get tables from all Work Spaces" send popup to (FLOATMENU_Apply(self)) end_procedure on_item "Add tables" send PopupFM end_object object oBtn2 is a aps.Multi_Button on_item "Sort tables" send DoSortTables end_object object oBtn3 is a aps.Multi_Button on_item "Reset list" send DoReset end_object //object oBtn4 is a aps.Multi_Button // on_item "Properties" send DoProperties //end_object object oBtn5 is a aps.Multi_Button on_item "Close" send close_panel end_object send aps_locate_multi_buttons set Border_Style to BORDER_THICK // Make panel resizeable procedure aps_onResize integer delta_rw# integer delta_cl# send aps_resize (oLst(self)) delta_rw# 0 // delta_cl# send aps_auto_locate_control (oTotal(self)) SL_DOWN (oLst(self)) send aps_register_multi_button (oBtn1(self)) send aps_register_multi_button (oBtn2(self)) send aps_register_multi_button (oBtn3(self)) // send aps_register_multi_button (oBtn4(self)) send aps_register_multi_button (oBtn5(self)) send aps_locate_multi_buttons send aps_auto_size_container end_procedure end_object #ELSE /oSortPropertiesPanel.hdr ÉÍSort propertiesÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º º /oSortPropertiesPanel.BadData_Radio º ÚÄBad dataÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ º ³ ³ º ³ ___ No check ³ º ³ ___ Fill with spaces ³ º ³ ___ Write to file ³ º ³ ___ Abort on bad data ³ º ³ ³ º ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ º /oSortPropertiesPanel.Duplicates_Radio ÚÄDuplicate recordsÄÄÄÄÄÄÄ¿ º ³ ³ º ³ ___ Write to file ³ º ³ ___ Abort on duplicates ³ º ³ ³ º ³ ³ º ³ ³ º ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ º º /oSortPropertiesPanel.frm º Sort buffer (kilo bytes): _______. º º º /oSortPropertiesPanel.btn º _____________ _____________ º º F2 Esc º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ /* object oSortPropertiesPanel is a app.ModalClient oSortPropertiesPanel.hdr set location to 6 11 ABSOLUTE on_key ksave_record send ok on_key kcancel send cancel object oRadBadData is a Radio oSortPropertiesPanel.BadData_Radio set location to 1 0 RELATIVE item_list on_item "" send next on_item "" send next on_item "" send next on_item "" send next end_item_list end_object object oRadDuplicates is a Radio oSortPropertiesPanel.Duplicates_Radio set location to 1 27 RELATIVE item_list on_item "" send next on_item "" send next end_item_list end_object object oForm is a Form oSortPropertiesPanel.frm set location to 10 0 RELATIVE item_list on_item "" send next end_item_list end_object object oBtn is a app.Button oSortPropertiesPanel.btn set location to 12 0 RELATIVE item_list on_item t.btn.ok send ok on_item t.btn.cancel send cancel end_item_list end_object procedure popup local integer liItem liGrb liBuffer liSortOptions liRval local integer iNull local string sNull move 0 to iNull move "" to sNull move 0 to liItem get piSortOptions of (oSortProperties(self)) to liSortOptions if (liSortOptions iand DF_SORT_OPTION_NO_DATA_CHECK ) move 0 to liItem if (liSortOptions iand DF_SORT_OPTION_BAD_DATA_FIXUP) move 1 to liItem if (liSortOptions iand DF_SORT_OPTION_BAD_DATA_FILE ) move 2 to liItem if (liSortOptions iand DF_SORT_OPTION_BAD_DATA_ABORT) move 3 to liItem set current_item of (oRadBadData(self)) to liItem move 0 to liItem if (liSortOptions iand DF_SORT_OPTION_DUP_DATA_FILE ) move 0 to liItem if (liSortOptions iand DF_SORT_OPTION_DUP_DATA_ABORT) move 1 to liItem set current_item of (oRadDuplicates(self)) to liItem call_driver iNull "DATAFLEX" function FLEX_GET_MAX_SORT_BUFFER callback iNull passing sNull iNull iNull result liBuffer set value of (oForm(self)) item 0 to liBuffer ui_accept self to liRval if liRval eq msg_ok begin move 0 to liSortOptions get current_item of (oRadBadData(self)) to liItem if liItem eq 0 move DF_SORT_OPTION_NO_DATA_CHECK to liSortOptions if liItem eq 1 move DF_SORT_OPTION_BAD_DATA_FIXUP to liSortOptions if liItem eq 2 move DF_SORT_OPTION_BAD_DATA_FILE to liSortOptions if liItem eq 3 move DF_SORT_OPTION_BAD_DATA_ABORT to liSortOptions get current_item of (oRadDuplicates(self)) to liItem if liItem eq 0 move (DF_SORT_OPTION_DUP_DATA_FILE +liSortOptions) to liSortOptions if liItem eq 1 move (DF_SORT_OPTION_DUP_DATA_ABORT+liSortOptions) to liSortOptions set piSortOptions of (oSortProperties(self)) to liSortOptions get value of (oForm(self)) item 0 to liBuffer call_driver iNull "DATAFLEX" function FLEX_SET_MAX_SORT_BUFFER callback iNull passing sNull iNull liBuffer result liGrb set piSortBuffer of (oSortProperties(self)) to liBuffer end end_procedure end_object // oSortPropertiesPanel /oSortUtil_Vw.hdr ÚÄSorting of tables listedÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ /oSortUtil_Vw.lst ³ ³ ³ Table Status ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ___ ___________________________________________________________ ____________ ³ ³ ³ /oSortUtil_Vw.btn ³ ____________ ____________ ____________ _____________ _____________ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ /* activate_view Activate_SortUtil_Vw for oSortUtil_Vw object oSortUtil_Vw is a app.Client oSortUtil_Vw.hdr action_bar (main_menu(self)) set location to 3 0 absolute object oLst is a cSortUtilList oSortUtil_Vw.lst set location to 1 0 relative end_object procedure DoSortTables send DoSort to (oLst(self)) end_procedure procedure DoGetTablesSelector_Help integer iFile integer iSelected integer iShaded local string sRoot get API_AttrValue_FILELIST DF_FILE_ROOT_NAME iFile to sRoot send SU_Add_Rootname sRoot end_procedure procedure DoGetTablesSelector send DFMatrix_CallBack_Selected_Files msg_DoGetTablesSelector_Help self 1 0 1 send fill_list to (oLst(self)) end_procedure procedure DoGetTablesDirectories local string sDir get SEQ_SelectDirectory "Select directory structure" to sDir if sDir ne "" begin send SU_Add_RootNamesInDirectories sDir send fill_list to (oLst(self)) end end_procedure procedure DoGetTablesDirectory local string sDir get SEQ_SelectDirectory "Select directory" to sDir if sDir ne "" begin send SU_Add_RootNamesInDirectory sDir send fill_list to (oLst(self)) end end_procedure procedure DoGetTableBrowse local string sRoot get SEQ_SelectInFile "Select data file" "*.DAT" to sRoot if sRoot ne "" begin send SU_Add_Rootname sRoot send fill_list to (oLst(self)) end end_procedure procedure DoProperties send popup to (oSortPropertiesPanel(self)) end_procedure procedure DoReset send reset to (oLst(self)) end_procedure object oBtn is a app.Button oSortUtil_Vw.btn set location to 14 0 relative procedure PopupFM send FLOATMENU_PrepareAddItem msg_DoGetTablesSelector "Get tables from table selector" send FLOATMENU_PrepareAddItem msg_DoGetTablesDirectory "Get all tables in folder" send FLOATMENU_PrepareAddItem msg_DoGetTablesDirectories "Get all tables in folder and below" send FLOATMENU_PrepareAddItem msg_DoGetTableBrowse "Browse for one table" send popup to (FLOATMENU_Apply(self)) end_procedure item_list on_item "Add tables" send PopupFM on_item "Properties" send DoProperties on_item "Sort tables" send DoSortTables on_item "Reset list" send DoReset on_item "Close" send Request_Cancel end_item_list end_object end_object #ENDIF