laptop and a wrench

Error

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

Última publicación: April 16, 2015 ArcGIS for Desktop
Número de ID del error BUG-000084817
EnviadoJanuary 27, 2015
Última modificaciónJanuary 19, 2021
Relacionado conArcGIS for Desktop
Versión encontrada10.1
Plataforma del servidorWindows
Plataforma cliente8.1
EstadoWill Not Be Addressed

Información adicional

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.

Solución alternativa

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.

Pasos para reproducir

ID del error: BUG-000084817

Software:

  • ArcGIS for Desktop

Obtener ayuda de expertos en ArcGIS

Contactar con soporte técnico

Descargar la aplicación de soporte de Esri

Ir a las opciones de descarga

Descubrir más sobre este tema