This should do the trick (backup your database first, so that if you don't get the expected results, you can easily restore your data):
GSK |
$_sql = "update caches set User3 = (select count(ccode)from waypoints where cparent = code) WHERE (select count(ccode) from waypoints where cparent = code) > 0" $status = Sqlite("sql",$_sql) RESYNC MFILTER Where=User3<>'' GOTO Position=Top WHILE NOT($_EOL) IF $d_UserNote="" $d_UserNote="This cache has " + $d_User3 + " child waypoint(s)" ELSE $Note=Extract($d_UserNote,"$~",1) $Note=RegExReplace("(?m)\r\nThis Cache has.*child waypoint\(s\)",$Note,"") $Log=Extract($d_UserNote,"$~",2) $d_UserNote=$Note + $_CrLf + "This cache has " + $d_User3 + " child waypoint(s)" ENDIF GOTO Position=Next ENDWHILE |