HOW TO

Set a variable to the number of selected records.

Last Published: April 25, 2020

Procedure

A RESELECT has been performed on a coverage or INFO file. How can a variable
be set to hold the number of selected records?

Answer:
This is possible using the AML [SHOW] and [EXTRACT] functions. Actual usage of the [SHOW] and [EXTRACT] functions to set a variable to the number of selected records varies by module.

In ARCPLOT, setting the variable would occur as follows after a RESELECT is
performed:

&setvar x = [EXTRACT 1 [SHOW SELECT ]]

Note that the RESELECT returns two values: the number of selected records,
and the total number of records in the attribute table or INFO file. Using the
[EXTRACT] function and specifying the number 1 sets the variable to the
first of the two values returned by the [SHOW] function.

In ARCEDIT, only the [SHOW] function is required to set a variable to the number of selected records. After performing a SELECT or RESELECT, the variable would be set as follows:

&setvar x = [SHOW NUMBER SELECT]

Article ID:000001306

Software:
  • ArcMap 8 x
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic