GSAK (Geocaching Swiss Army Knife)

Contents - Index

Table (command)

TABLE <Active=caches|logs|waypoints|corrected> [<Scope=Parent|All|Same>]

The Table command allows you to select the current table in the macro language. A GSAK database comprises mainly of 4 tables. Caches - The master for all "cache" data. Logs - All log entries associated with a cache. Waypoints - Any child waypoints associated with the cache. Corrected - All corrected coordinates

Active - This parameter determines which table will be current for certain operations. Currently, this only applies to the GOTO command and the system variables $_EOL and $_Count. When a macro first starts, the default active table is "caches"

Scope - This parameter only applies to "waypoints", "logs", and "correct". All, means you have access to all the records in the table. Using a Goto Position=Top will take you to the very first record in the table. Goto Position=Bottom will take you to the very last record in the table. $_EOL is only set to true when you read past the very last record on the file. Parent, means you only have access to those records that belong to the parent. Goto Position=Top will take you to the first child of the parent, Goto Position=Bottom will take you to the last child of the parent. The "parent" is what ever record your "caches" table is currently set to. $_EOL is set to true when ever you try to read a child that does not belong to the current parent. If there are no child records $_EOL will be true, and $_Count equals 0. When you use the TABLE command with a scope of parent or all, you are immediately placed at the first record in that scope (same as if you issue the command Goto Position=Top). Same, (default value, so you can omit this parameter when requesting "same") enables you to set another table to be the active one, but not move the record pointer to the top. That is, the record pointer will be left on the same child record as before (as long as you haven't run another command that would cause the record pointer to move in the mean time)

For a complete list of database variables you can use for each TABLE see Database Variables

Example 1 - show the total number or records in each table

# default is "caches" so no need for TABLE command first
$msg = "Total Caches = $_Count" + $_NewLine

Table Active=Logs Scope=All
$msg = $msg + "Total Logs = $_Count" + $_Newline

Table Active=Waypoints Scope=All
$msg = $msg + "Total child waypoints = $_Count"

Pause Msg=$msg

Example 2 - Flag only "parking area" for selection on GPSr send

Goto Position=top
while not ($_eol)
  table active=waypoints scope=parent
  while not($_eol)
     if $d_cType = "Parking Area"
       $d_cFlag = True
       $d_cFlag = False
    Goto Position=Next
  Table active=caches
  Goto position=Next
Goto position=Top

Example 3 - Set a filter on all caches that have only parking child waypoints 

MacroFlag Type=Clear Range=All
Goto Position=Top
While not ($_eol)
  Table Active=Waypoints Scope=Parent
  while not ($_eol)
     if $d_cType = "Parking Area"
       $d_MacroFlag = True
     Goto Position=Next

  Table Active=caches
  Goto position=Next
Mfilter If=$d_MacroFlag

Alpha List         Category List
Copyright 2004-2011 CWE Computer Services  
Privacy Policy Contact