laptop and a wrench

Bug

The AND operator does not work as expected in an advanced label expression.

Zuletzt veröffentlicht: April 16, 2015 ArcGIS for Desktop
Bug-ID-Nummer BUG-000084817
EingereichtJanuary 27, 2015
Zuletzt geändertJanuary 19, 2021
Gilt fürArcGIS for Desktop
Gefunden in Version10.1
Server-PlattformWindows
Client-Plattform8.1
StatusWill Not Be Addressed

Zusätzliche Informationen

We apologize that we were unable to address this issue within the current product support cycle.  If the issue continues to affect your work in a supported release, please contact Technical Support.

Workaround

Rather than using the AND operator in the label expression, create multiple Label Classes (one for each condition), use the SQL Query option to select features that meet the initial expression (such as Yes or No), and then use a simplified version of the expression to label the features. This allows users to break down the complex label expression and bypass the AND operator by working with multiple labels classes instead. For example: Original Expression: Function FindLabel ([YesNo], [ColorOption]) if ([YesNo] = "YES" AND [ColorOption] = "Red") then FindLabel = [YesNo] & vbNewLine & [ColorOption] elseif ([YesNo] = "NO" AND [ColorOption] = "Red") then FindLabel = [ColorOption]& vbNewLine &[YesNo]end ifEnd FunctionLabel Class one Yes:1. Open the layer Properties and click on the Labels tab2. Select “Define classes of features and label each class differently” form the Method dropdown3. Rename the current class to an appropriate name. 4. Click on the SQL Query… button - This allows users to set a query on the layer so that those features meeting this argument are the only ones shown with this label style5. Specify the SQL Query to be used for this label class and click OK- Example: SUBTYPE_YN = YES6. Click on the expression button and build the expression for this particular class and click OKFunction FindLabel ([YesNo], [ColorOption]) if ([ColorOption] = "Red") then FindLabel = [YesNo] & vbNewLine & [ColorOption]end ifEnd FunctionLabel Class two No:1. Click the Add… button to add the second label class.2. Give the new label class an appropriate name. In this case, use SUBTYPE_CD 2 because that is what this class grouped by.3. Click on the SQL Query… button 4. Specify the SQL Query to be used for this label class and click OK- Example: SUBTYPE_YN = NO5. Click on the expression button and build the expression for this particular class and click OKFunction FindLabel ([YesNo], [ColorOption]) if ([ColorOption] = "Red") then FindLabel = [ColorOption] & vbNewLine & [YesNo]end ifEnd FunctionThe first label class only label features that match the YES SQL Query and the second will only label those that match the NO SQL Query.

Schritte zur Reproduzierung

Bug-ID: BUG-000084817

Software:

  • ArcGIS for Desktop

Hilfe von ArcGIS-Expert*innen erhalten

Technischen Support kontaktieren

Die Esri Support-App herunterladen

Zu den Download-Optionen

Weitere Informationen zu diesem Thema erkunden