Page 1 of 1

Getting rid of old data?

Posted: November 19th, 2019, 3:58 am
by Anne
Hi,
I'm working on an app to collect prices for CPI, and of course I want to compare to the prices last month. Hence I have an external dictionary with a csdb file of the relevant data.
And each month, I want to get rid of the data that I don't need anynore. I can't just delete the datafile as it's already opened in the app, so I tried to loop through it using delcase on every observation before reading the new data from a tab separated file.
This work-ish, but I notice that the datafile grows despite the number of occurences stays approximately the same, and this is of course a worry in the long run.

Any other suggestion on how to do it? (I guess I could make a separate app which does not open the dictionary and use this to delete the datafile, but this is also not very elegant..

Anne

Re: Getting rid of old data?

Posted: November 19th, 2019, 6:35 am
by Gregory Martin
Cases deleted from the .csdb file actually aren't removed. They're simply marked as deleted. However, unless you're syncing that data to a server, then the size of the file isn't that important. The .csdb file has indices on several fields so operating on it should be of a similar speed regardless of how much data is in the file.

However, if you do want to truly delete everything in the file, you should be able to do this:
open(CPI_DICT, create);

Re: Getting rid of old data?

Posted: November 19th, 2019, 8:37 am
by Anne
As the data file grew by almost 1 Mb per month, I feel it's safer to delete the data, as they're not used anymore anyway..

And the "create" argument worked perfectly. Thank you! Would never have thought about it..

A