laptop and a wrench

Bogue

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

Dernière publication: April 16, 2015 ArcGIS for Desktop
Numéro d’ID de bogue BUG-000084817
EnvoiJanuary 27, 2015
Dernière modificationJanuary 19, 2021
S’applique àArcGIS for Desktop
Version trouvée10.1
Plateforme serveurWindows
Plateforme client8.1
StatutWill Not Be Addressed

Informations supplémentaires

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.

Solution de contournement

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.

Étapes pour reproduire

ID de bogue: BUG-000084817

Logiciel:

  • ArcGIS for Desktop

Obtenir de l’aide auprès des experts ArcGIS

Contacter le support technique

Télécharger l’application Esri Support

Accéder aux options de téléchargement

En savoir plus sur ce sujet