Use Windows.pkg Object pDatocheck is a ModalPanel Set Location to 10 19 Set Size to 159 242 Set Label to "Date check" Object aFilelist is an array End_Object Property Integer pFilelistantal public 0 Set Border_Style to Border_Thick Set piMinSize to 159 242 Object grdFilelist is a grid Set Location to 3 3 Set Size to 123 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)) Open FileNum Mode DF_SHARE 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 DoDatocheck Integer aktFilelist Filenum maxFilelist iSelect iMaxField Integer Retval oCallback ihandle iDummy iRettet iActField Integer iEpoch iFieldType iDato iDoSave iMaxRec iActRec iOldPct iActPct String Fildir Rootname besked displayname sEp Get pFilelistantal to maxFilelist Send skriv "Datecheck-process started." Move 0 to iEpoch Get_Profile_String "Defaults" "Epoch" to sEp Trim sEp to sEp Move (Ascii(sEp)) to iEpoch If (iEpoch = 0) Move 30 to iEpoch calc (iEpoch * 365.25) to iEpoch Send cursor_wait to (cursor_control(current_object)) Send Initialize_StatusPanel of oUpdateStatusPanel "NOVAX - Database maintenance - Date check" "" "" Send Start_StatusPanel of oUpdateStatusPanel While ((aktFilelist < maxFilelist) and (giErrorStop <> 1)) 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_SHARE If (Found) 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_NUMBER_FIELDS of FileNum to iMaxField Get_Attribute DF_FILE_RECORDS_USED of FileNum to iMaxRec Set Statustekst of oUpdateStatusPanel to ("Current table: "+displayname+ ".") Move 0 to iRettet Move 0 to iActRec Move -1 to iOldPct Send FileprogresseStatus of oUpdateStatusPanel 0 100 0 Set_Date_Attribute date4_state to dfFalse Clear filenum Vfind filenum 0 4 // Find GT via recnum While ((giErrorStop <> 1) and (iActRec < iMaxRec)) Increment iActRec Move ((iActRec * 100.0) / iMaxRec) to iActPct If (iOldPct < iActPct) Begin Send FileprogresseStatus of oUpdateStatusPanel -1 -1 iActPct Move iActPct to iOldPct End Move 0 to iDoSave Reread filenum For iActField from 1 to iMaxField Get_Attribute DF_FIELD_TYPE of FileNum iActField to iFieldType If (iFieldType = DF_DATE) Begin Get_Field_Value FileNum iActField to iDato If ((iDato < 36525) and (iDato > 0)) Begin // < 100 i year. Increment iDoSave If (iDato < iEpoch) Add 36525 to iDato Add 693975 to iDato Set_Field_Value FileNum iActField to iDato End End Loop If (iDoSave) Begin SaveRecord filenum If not giErrorStop Add iDoSave to iRettet End Unlock If (gierrorstop <> 2) Vfind filenum 0 4 // Find GT via recnum Loop Set_Date_Attribute date4_state to dfTrue Move "Date check result for " to besked Append besked displayname ":" (Character(13)) (Character(10)) (Character(13)) (Character(10)) Append besked "Dates corrected: " (String(iRettet)) (Character(13)) (Character(10)) If (not(pAutoMode(Self))) Begin Send Stop_StatusPanel of oUpdateStatusPanel Send info_box besked Send Start_StatusPanel of oUpdateStatusPanel End Send skriv besked Close Filenum End End If (gierrorstop <> 2) Begin Increment aktFilelist End Loop If (not(gierrorstop)) Send skriv "Datecheck-process ended." Else Send skriv "Datecheck-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 DoDatoCheck 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