How do I delete crash records from the database?
On occasion it may be useful to be able to delete a specific group of cases from the database. The IMWEdit program contains an option to do this.
Sometimes data gets into the database that is not desired. Perhaps the import definition was wrong, perhaps you received incorrect data. To remove this data from the database simply requires that you prepare a list of which cases you want deleted.
IMWEdit, which is part of Intersection Magic, has an option to “delete list of records”. It requires that you prepare a list of case id numbers in a text file for input.
To delete all data for a particular time period, the easiest thing would be to:
- As always – please backup your data – just in case 🙂
Utilities / Database / Copy
- Create an all data diagram for the desired time period. (a summary is fine) File / New diagram: All Data | Date range 1/1/2004 – 12/31/2004 | clear filter
Note: If you would like to include only certain records, you could specify a filter at this point (i.e. county = El_Paso)
- Then click on the accident list button and create a new report that contains only “case id” and “date”
Reports / Listing / All accidents: New RPT
Select CaseID: Width 20 / Insert
and Date: Width 20 /Insert
Select Ok to save this field list
In the Sort first by option, Choose “date”
Select Delimit data with “spaces”
- Choose Ok. You will be presented with a list of case id’s and dates seperated with spaces. (don’t worry about the header info) Review the data to make sure it’s what you want to delete. (you’re welcome to add other fields if you’re not sure)
- Save this file as “ToDelete.txt”
File / Save
- Close the list and the diagram.
Window / Close all
- Start IMWEdit
Utilities / Database / IMWEdit
- Select Accidents / delete list of records and choose the file you saved “toDelete.txt”. Select “No” when prompted to override normal behaviour.
- You will be presented with a list of case id’s to delete. This list has been loaded from the file, parsed, and checked to be sure that each one exists in the database. If this list is empty, it is because the case id’s specified are in the wrong format, or do not exist in the database. (The program only looks at the first field in the listing – it ignores everything following it)
If everything looks ok, select “Yes”.
- You will be informed how many records were deleted.