laptop and a wrench

Erro

When a hosted feature layer view has both a view definition/filter and a topFilter parameter applied, ArcGIS Online appears to apply the topFilter parameter first and then the view definition, causing the topFilter parameter to return records filtered out by the view definition.

ArcGIS Online
Número de ID do Erro BUG-000164286
EnviadoJanuary 11, 2024
Última ModificaçãoMay 27, 2025
Aplica-se àArcGIS Online
Versão encontradaOct 2023
Sistema OperacionalN/A
Versão do Sistema OperacionalN/A
StatusAs Designed

Informações Adicionais

This is a known behavior regarding the execution order of filters in feature services. When both viewDefinitionQuery and topFilter are applied to a feature service, the system processes the topFilter first, followed by the viewDefinitionQuery. To achieve simultaneous execution of both filtering operations, the correct approach is to structure the query using sqlExpression within the viewLayerDefinition instead of using viewDefinitionQuery directly. The recommended structure is: json{ "viewDefinitionQuery": "", "viewLayerDefinition": { "filter": { "sqlExpression": "status = 'Active'" }, "topFilter": { "orderByFields": "CreationDate DESC", "groupByFields": "Name", "topCount": 1 } } } This structure ensures that both the SQL expression filter and the top filter are processed together, providing more precise control over the returned data and preventing unexpected results that may occur when filters are applied in sequence.

Solução Provisória

For query purposes, it is recommended to not add the topFilter parameter on the view definition. Use the queryTopFeatures method to get the correct result.

Etapas para Reproduzir

ID do Erro: BUG-000164286

Software:

  • ArcGIS Online

Seja notificado quando o status de um erro mudar

Baixe o Aplicativo de Suporte da Esri

Descubra mais sobre este tema

Obtenha ajuda de especialistas do ArcGIS

Entre em contato com Suporte Técnico

Baixe o Aplicativo de Suporte da Esri

Ir para as opções de download