Hello

im trying sort an output array of a ma-point-statistics .. I sort it correctly but then i need to be able to get or print or copy the max value to a variable

Basically i have

```
<ma-calc input="day | maMoment:'add':preset:'days'" output="day2"></ma-calc>
<ma-calc input="day2 | maMoment:'set':{'hour': 5, 'minute': 0}" output="from"></ma-calc>
<ma-point-query query="'or(name=like=STR_5*)'" limit="300" points="box5"></ma-point-query>
<ma-point-values points="box5" values="box5_val" from="from" to="dateBar.to" rollup="INTEGRAL" rollup-interval="1 DAYS">
</ma-point-values>
<ma-point-statistics points="box5" rendered=false from="from" to="dateBar.to" statistics="statsObj"></ma-point-statistics>
{{ statsObj | orderBy:'-integral.value'}}
{{statsObj[0].integral.value }}
<script>
console.log(statsObj);
</script>
```

I would expect that the {{statsObj[0].integral.value }} would give me the 0 entry of my sorted array so the max integral value .. but it doesnt . it still gives me the first entry of the unsorted array..

Is there a way to copy it to a new array and there have the sorted one ?

```
{{statsObj2=statsObj | orderBy:'-integral.value'}}
{{statsObj2[0].integral.value }}
```

the above is not working

maybe with javascript ?

- by the way i try to console.log the statsObj and i got error is not defined .. how do i console.log the output of any of the mango directives ?

```
<script>
console.log(statsObj);
</script>
```

the above gives me error statsObj is undefined

- basically im trying to find the maximum of integral of few data points

What is the best approach that i have above?

a)

```
<ma-point-query query="'or(name=like=STR_5*)'" limit="300" points="box5"></ma-point-query>
<ma-point-values points="box5" values="box5_val" from="from" to="dateBar.to" rollup="INTEGRAL" rollup-interval="1 DAYS">
</ma-point-values>
```

or b)

```
<ma-point-query query="'or(name=like=STR_5*)'" limit="300" points="box5"></ma-point-query>
<ma-point-statistics points="box5" rendered=false from="from" to="dateBar.to" statistics="statsObj"></ma-point-statistics>
```

which is the fastest computing method and more clever way to do it ?

In the same page i will have multiple pairs of (queries and ma-point-statistics) or (queries and ma-point-values) .. Which is the one that will crash less the system and is more time and cpu efficient?

thank you !