Did I ever mention that I like cache trails? (Yes Cass, a HUNDRED times!) OK well, as I like trails so much and I’m playing around with GSAK at the moment I had a thought on how I could get myself a little macro to sort the data in GSAK into trails. I thought my prayers had been answered when I found this post on the macro list, but all that did was show me a list of trails in a pop-up box, it didn’t give me anything to sort my data with. So I decided to utilize the code from that one to make my own…
The code searches through the GSAK records and creates a new database, then performs SQL queries to look for cache names with x number of matching characters. I’ve got it set to 16 so it knows that if there are say 10 caches called “Wow what a really great trail” it matches “Wow what a reall” and finds all 10 and marks them as a trail. It also now does a reverse search, so if you have caches in a series named “#1 Great Caching Series”, “#2 Great Caching Series” it wouldn’t pick up from the front of the name, instead it matches “t Caching Series” at the end.
I added to this code so that it would insert these trail names into an array, then pick through each one and add the value the matching portion of the trail name to the ‘UserData2′ field, and the number of caches in that trail to the ‘UserData3′ field. Now I can sort all of my trails, and sort by the number of caches in each one. It also strips out any caches named ‘Sidetracked’ and ‘Church Micro’ as these aren’t trails, but are common names.
I thought I’d put it to the test and loaded in 1000 caches from Birmingham, 1000 from Worthing, 1000 from Bristol, 350 from Chelmsford, My finds from a few weeks ago (538), and 350 from Harlow, giving just over 3000 caches…
Well, it took at least about 10 mins to go through all the records. I don’t know if it’s just because of the amount of records, or if it just isn’t the most efficient code for the job, but the results are pretty darn good (If I do say so myself) I’m very pleased with it!
It’s never going to be perfect because it isn’t totally intelligent. For example, I have a large trail called “3SW”. This means I’d have to lower the matching number to 3 to grab this, however doing so would classify a load of other names as trails that aren’t trails. But on the whole, it catches most of the trails. This is definitely something I’m going to use to organize my caches, and hope it’s useful to others too. I think I need to add a nice interface, and look into some more efficient code, but on the whole I’m pretty pleased with my code! 🙂
The code is here:
(As a side note, I used a website to convert my doc file to a PDF, it did it in a few seconds and I didn’t need to download anything! Cool! Had to upload a PDF as WordPress is limited as to what I can upload here)