Hi, so I'm trying to find the maximum value for a field using summary Statistics however im getting an undefined value when trying to do console.log()
var maxVAL=0;
summaryStatistics({
layer: fieldlayer,
field: "fieldName",
}).then(function(stats){
maxVAL= stats.max;
// console.log(maxVAL) // works here
});
console.log(maxVAL)