GSAK (Geocaching Swiss Army Knife)
Global replace (Database=>Global Replace) will allow you to replace column values for many waypoints in one single action. The column you select in the replace drop down box will be replaced by the value you select/enter in the "with" section. Only the waypoints in your current filter are updated.
Replace - Select the column that you want all the records in your current subset to have the current value replaced by the "with" value.
With - Select the value you want the "replace" column to be set.
Replace - What ever you enter completely replaces the corresponding data in the database. If you want to clear/delete a string column, then leave the "With" box blank.
Add Before - The data is appended before the start of the data. That is, treated as a prefix.
Add After - The data is appended after the end of the data. That is, treated as a suffix.
Remove - Any occurrence of this string is removed from this data in the database. For example, if the field contained the data "RedFox" and you entered "Red" in the with, then the result of the update would be that the field now contains "Fox".
Swap - Requires a from and to value. Separate your from and to value with a ; (semi colon). Any string found with the from value is replaced with the to value
Close dialog after replace - Uncheck this box if you want the dialog to remain open after doing the replace (you would usually want this when doing more than one replace)
With raw sql - When this box is checked, the string is interpreted as SQL rather than a string literal. In the screenshot below, UserData would be replaced with the corresponding cache code rather than the literal string "code" (as would be the case if the box was unchecked). If you wanted to update UserData with a field from your custom table then it can be done but the syntax is a little more involved. For example, let us say we have two fields called Data1 and Data2 in our custom table. We would like to concatenate these two fields and update UserData. Your "With" would then be:
Similar syntax is required if you wanted to update a custom field with data from the main caches table. For example, going the other way you wanted to concatenate User2 and User3 and place the value in the custom field called Data1, the code would be:
Note1: Global replace will protect the integrity of the database. That is, any change that would cause "illogical" values in the database will not be updated. For example if you do a global replace of all caches to "not found", any caches that have found logs will be "protected" and not have their status set to not found (depending on your setting for "Interrogate Logs for Founds/DNF etc" )
Note2: Global replace (for string fields) supports any characters via the chr() function. This may be required if you want to update your database with characters that are not easy to access from the keyboard. Also it allows you to use the ; (semi colon character) when using the swap option. The problem with the swap option is that it requires two parameters (from and to) and they must be separated by a ;. So if you wanted to use a ; as part of your actual swap data you have a problem. For example, if you now want to swap any occurrence of ";" to a "!" you would enter:
Copyright 2004-2011 CWE Computer Services |