<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcPad vbscript- How to zoom to selected records in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/arcpad-vbscript-how-to-zoom-to-selected-records/m-p/197341#M1437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need help with my custom tool button.....&lt;/P&gt;&lt;P&gt;There's sample code to zoom to a selected record, but I'm having trouble finding sample code that will zoom to a selection set(more than one feature) of point features/records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the work flow...&lt;/P&gt;&lt;P&gt;1) A user would filter the trees based on inspection type, then only those trees would show on the map.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2) then I created another button to reset the field TreeActivity to NULL.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;3) When a tree is inspected the user will calc the TreeActivity field to "Inspected" and the symbol of the tree would change, so the user would know what trees are left to be inspected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The button in step 2 is where I need the to be able to zoom to the extent of all selected records. Here's my sub for step 2. Application.ExecuteCommand("zoomfullextent") is zooming the extent of the layer and not the selected features,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Sub ResetActivity


&amp;nbsp; Dim treeDataSource, cntQry, testSQL
&amp;nbsp; Set treeDataSource = Map.Layers("Tree").Datasource
&amp;nbsp; Set cntQry = treeDataSource.Execute("SELECT * FROM [TREE] WHERE " &amp;amp; sqlFilter &amp;amp; " AND TREEACTIVITY = 'VACANT'")
&amp;nbsp; if cntQry.recordCount &amp;gt; 0 then
&amp;nbsp; MsgBox cntQry.recordcount &amp;amp; " records will be reset NULL"
&amp;nbsp; 'treeDataSource.Execute("UPDATE [TREE] SET TREEACTIVITY = 2 WHERE " &amp;amp; sqlFilter &amp;amp; "")
&amp;nbsp; testSQL = "UPDATE [TREE] SET TREEACTIVITY = 2 WHERE " &amp;amp; sqlFilter
&amp;nbsp; MsgBox testSQL
&amp;nbsp; Application.ExecuteCommand("zoomfullextent")
&amp;nbsp; else
&amp;nbsp; MsgBox "No records Selected"
&amp;nbsp; end if


&amp;nbsp; treeDataSource.Close()

&amp;nbsp; 'Clear objects
&amp;nbsp; Set treeDataSource = Nothing
&amp;nbsp; Set cntQry = Nothing


End Sub&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 09:51:31 GMT</pubDate>
    <dc:creator>JuneAcosta</dc:creator>
    <dc:date>2021-12-11T09:51:31Z</dc:date>
    <item>
      <title>ArcPad vbscript- How to zoom to selected records</title>
      <link>https://community.esri.com/t5/arcpad-questions/arcpad-vbscript-how-to-zoom-to-selected-records/m-p/197341#M1437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need help with my custom tool button.....&lt;/P&gt;&lt;P&gt;There's sample code to zoom to a selected record, but I'm having trouble finding sample code that will zoom to a selection set(more than one feature) of point features/records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the work flow...&lt;/P&gt;&lt;P&gt;1) A user would filter the trees based on inspection type, then only those trees would show on the map.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2) then I created another button to reset the field TreeActivity to NULL.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;3) When a tree is inspected the user will calc the TreeActivity field to "Inspected" and the symbol of the tree would change, so the user would know what trees are left to be inspected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The button in step 2 is where I need the to be able to zoom to the extent of all selected records. Here's my sub for step 2. Application.ExecuteCommand("zoomfullextent") is zooming the extent of the layer and not the selected features,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Sub ResetActivity


&amp;nbsp; Dim treeDataSource, cntQry, testSQL
&amp;nbsp; Set treeDataSource = Map.Layers("Tree").Datasource
&amp;nbsp; Set cntQry = treeDataSource.Execute("SELECT * FROM [TREE] WHERE " &amp;amp; sqlFilter &amp;amp; " AND TREEACTIVITY = 'VACANT'")
&amp;nbsp; if cntQry.recordCount &amp;gt; 0 then
&amp;nbsp; MsgBox cntQry.recordcount &amp;amp; " records will be reset NULL"
&amp;nbsp; 'treeDataSource.Execute("UPDATE [TREE] SET TREEACTIVITY = 2 WHERE " &amp;amp; sqlFilter &amp;amp; "")
&amp;nbsp; testSQL = "UPDATE [TREE] SET TREEACTIVITY = 2 WHERE " &amp;amp; sqlFilter
&amp;nbsp; MsgBox testSQL
&amp;nbsp; Application.ExecuteCommand("zoomfullextent")
&amp;nbsp; else
&amp;nbsp; MsgBox "No records Selected"
&amp;nbsp; end if


&amp;nbsp; treeDataSource.Close()

&amp;nbsp; 'Clear objects
&amp;nbsp; Set treeDataSource = Nothing
&amp;nbsp; Set cntQry = Nothing


End Sub&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:51:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/arcpad-vbscript-how-to-zoom-to-selected-records/m-p/197341#M1437</guid>
      <dc:creator>JuneAcosta</dc:creator>
      <dc:date>2021-12-11T09:51:31Z</dc:date>
    </item>
  </channel>
</rss>

