HOW TO
You can limit which records of a dataset are present as features in a theme
by applying a Theme Definition Query. This article demonstrates how to apply a theme definition for the ESRI sample data counties.shp so that only Ohio counties are present. For more information refer to the ArcView Help topic "Defining a feature selection for a theme."
Code:
'-- Creating a new theme from a feature source:
theView = av.GetActiveDoc
'-- Replace the path to match your feature data source
theTheme = Theme.Make("c:\esri\esridata\usa\counties.shp".AsSrcName)
theTheme.SetName("Ohio Counties")
theView.AddTheme(theTheme)
theFTab = theTheme.GetFTab
'-- Example of using a string field for query
SearchStr = MsgBox.Input("Enter the Search String:",
"Input Window", "Ohio")
theQuery = "[State_Name] = " + SearchStr.Quote
theFTab.SetDefinition(theQuery)
'-- Example of using a numeric field for query
'theFTab.SetDefinition("[Fips] = 2336")
theTheme.SetVisible(true)
theTheme.SetActive(true)
Note:
The path to the counties shapefile referenced in the second line of code may differ from the path on your machine. Edit this path to match the sample data directory on your machine or to point to another data set.
Article ID:000003919
Get help from ArcGIS experts
Download the Esri Support App