Select to view content in your preferred language

Arcade - sum value of field in two layers (integer) and get others fields (e.g Date)

200
0
02-27-2025 07:42 AM
SIG-EscutismoCNE
Emerging Contributor

Good afternoon,

I was able to make the sum of two layers that contained a different attribute.

The question here is whether it is possible to bring the date field so that you can make the Date Selector that is in the Dashboard?

 

Sum of two layer (Via Arcade)

// Usar FeatureSetByPortalItem para acessar a camada através do Portal
var portal = Portal('https://sig-escutismo.maps.arcgis.com');  // Endereço do seu portal
var fs1 = FeatureSetByPortalItem(portal, 'c5a5d101f83b4860b7b3bd67ea8811b5', 'Formulario_Agrup', ['n_lobitos']);
var fs2 = FeatureSetByPortalItem(portal, '955838271a704732a4e93de1ed17b239', 'Formulario_RegiaoNucleo', ['n_lobitos']);

// Inicializa a soma
var running_sum = 0;

// Soma os valores do campo 'n_lobitos' de cada camada
var set_sum1 = Sum(fs1, 'n_lobitos');
Console('Sum from Formulario_Agrup (Portal):', set_sum1);
running_sum += set_sum1;

var set_sum2 = Sum(fs2, 'n_lobitos');
Console('Sum from Formulario_RegiaoNucleo (Portal):', set_sum2);
running_sum += set_sum2;

// Retorna o FeatureSet com a soma total
return FeatureSet({
  fields: [{name: 'sum_n_lobitos', type: 'esriFieldTypeInteger'}],
  geometryType: null,  // Não estamos utilizando geometria
  features: [{attributes: {sum_n_lobitos: running_sum}}]
});
 
 

Does not bring the date field in the sum...

SIGEscutismoCNE_0-1740670699720.png

 

 

Any solution?

0 Kudos
0 Replies