Use Windows.pkg Object pIndex is a ModalPanel Set Location to 8 16 Set Label to "Reindex" Set Size to 158 241 Object aFilelist is an array End_Object Property Integer pFilelistantal public 0 Set Border_Style to Border_Thick Set piMinSize to 158 241 Object grdFilelist is a grid Set Location to 2 2 Set Size to 127 237 Set Line_Width to 2 0 Set resize_column_state to False Set Header_Label item 0 to 'Indx' Set form_width item 0 to 30 Set Header_Label item 1 to 'Table' Set form_width item 1 to 200 Set select_mode to multi_select Set peAnchors to anAll Procedure Fill_the_List String Rootname Besked Displayname Logicalname Integer Filenum iMaxRec iNumRec StructHandle iNyMaxRec Integer maxFilelist oFilelist Send cursor_wait to (cursor_control(current_object)) Move (aFilelist(Self)) to oFilelist Send delete_data to oFilelist Send delete_data to giset Send delete_data Move 0 to maxFilelist Move 0 to Filenum // Start at top of current filelist Move 0 to gierrorstop Send ignore_all to error_info_object Repeat Get_Attribute DF_FILE_NEXT_USED of FileNum to FileNum If Filenum Begin Get_Attribute DF_FILE_ROOT_NAME of FileNum to Rootname Get_Attribute DF_FILE_DISPLAY_NAME of FileNum to Displayname Get_Attribute DF_FILE_LOGICAL_NAME of FileNum to Logicalname If (((Uppercase(Trim(Rootname))) <> "FLEXERRS") and (find_element(giset, (Uppercase(Rootname))) = -1)) Begin Send add_element to giset (Uppercase(Rootname)) indicate Found False If (left(Uppercase(Trim(Rootname)), 9) <> "MSSQLDRV:") Begin Open FileNum Mode DF_EXCLUSIVE End If (Found) Begin // The file could be opened. Send Add_Item 0 0 Set checkbox_item_state item maxFilelist to True Move Filenum to besked Append besked ", " Displayname ", " Rootname Send Add_item 0 besked Set array_value of oFilelist item maxFilelist to Filenum Increment maxFilelist Set array_value of oFilelist item maxFilelist to Rootname Increment maxFilelist End Else Begin Send Add_Item 0 0 Set checkbox_item_state item maxFilelist to True Move Filenum to besked Append besked ", " Displayname ", " Rootname Send Add_item 0 besked Set item_shadow_state item maxFilelist to True Set item_shadow_state item (maxFilelist +1) to True Set array_value of oFilelist item maxFilelist to (Filenum * -1) Increment maxFilelist Set array_value of oFilelist item maxFilelist to Rootname Increment maxFilelist End Close FileNum End End Until ((FileNum = 0) or (gierrorstop)) Set pFilelistantal to (maxFilelist -1) Send trap_all to error_info_object Send cursor_ready to (cursor_control(current_object)) End_Procedure Procedure Set Current_item Integer Itm // Prevent that focus is moved to column 1 with filenames. If (Mod(Itm, 2) = 0) Forward Set Current_Item to Itm End_Procedure End_Object Procedure DoReindex Integer aktFilelist Filenum maxFilelist iSelect indextype Integer indexnummer SidsteIndex Retval oCallback ihandle iDummy String Fildir Rootname besked displayname sFil sIndexes Boolean bSletOk Get pFilelistantal to maxFilelist Send skriv "Reindex-process started." Send cursor_wait to (cursor_control(current_object)) Send Initialize_StatusPanel of oUpdateStatusPanel "NOVAX - Database maintenance - Reindexing" "" "" Send Start_StatusPanel of oUpdateStatusPanel For aktFilelist from 0 to maxFilelist Get select_state of (grdFilelist(Self)) item aktFilelist to iSelect If iSelect Begin Get integer_value of (aFilelist(Self)) item aktFilelist to Filenum Open FileNum Mode DF_EXCLUSIVE Get_Attribute DF_FILE_LAST_INDEX_NUMBER of FileNum to Sidsteindex Get_Attribute DF_FILE_ROOT_NAME of FileNum to Rootname Get_Attribute DF_FILE_DISPLAY_NAME of FileNum to Displayname Move "" to sIndexes // Be sure that there are not a .bad file before reindexing. // The Sort command does not delete old .bad files by itself. Move (FilSti(rootname + ".DAT")) to fildir Append fildir "\" Move (fildir + rootname + ".BAD") to sFil Uppercase sFil Get FileDelete of oFilesystem sFil to bSletOk Set Statustekst of oUpdateStatusPanel to ("Aktuelt register: "+displayname+ ".") If Sidsteindex Begin Get DeleteAllIndexFiles fildir rootname to bSletOk Get TekstIndex Filenum to sIndexes If (sIndexes <> "") Begin Send SetDfOpenPathToCurrentDataFile (rootname + ".DAT") Sort Filenum sIndexes ((DF_SORT_OPTION_BAD_DATA_FILE) ior (DF_SORT_OPTION_DUP_DATA_FILE)) ghoCallbackProgressBar Send ResetDfOpenPath End End Send CallbackStatus of oUpdateStatusPanel 0 100 0 Get FileExists of oFilesystem sFil to Retval If retval Begin Error 902 displayname End Close FileNum End Loop If (not(gierrorstop)) Send skriv "Reindex-process ended." Else Send skriv "Reindex-process stopped." Send cursor_ready to (cursor_control(current_object)) Send ClearAllPB of oUpdateStatusPanel Send Stop_StatusPanel of oUpdateStatusPanel End_Procedure Object cmdStart is a button Set Location to 135 40 Set Size to 18 58 Set label to "Start" Set peAnchors to anBottomLeft Procedure onClick Send DoReindex End_Procedure End_Object Object cmdExit is a button Set Location to 135 138 Set Size to 18 58 Set label to "Close" Set peAnchors to anBottomRight Procedure onClick Send close_panel End_Procedure End_Object Procedure popup Send Fill_the_List to (grdFilelist(Self)) Forward Send popup End_Procedure End_Object