Array elements Glideaggregate

JG16
Tera Contributor

Hi,

I am doing like this 

var ga = new GlideAggregate(theTable);
    ga.addAggregate('COUNT', dpField);
    ga.addHaving('COUNT', dpField, '>', '1');
    ga.query(); 
    var arDupes = new Array();
    while (ga.next()) { 
      arDupes.push(ga.getValue(dpField));    
    }
  Unfortunately I am getting all array elements are same and last value.
But if I put his.info then it is logging different values.

Please help me why is this behaviour ?

 

Thanks 

JG

 

 

1 ACCEPTED SOLUTION

Abhishek Pidwa
Kilo Guru

I believe you meant when you do gs.addInfoMessage(ga.getValue(dpField)) you are getting different values ? 

 

In such case just modify your line of code from 

 

var arDupes = new Array(); 

 

to 

var arDupes = [];

 

Try this and let me know what you get after iterating through the array ?

 

View solution in original post

5 REPLIES 5

JG16
Tera Contributor

Dear All,

 

Thank you so much for your help. 

 

I have cleared cached and restarted my machine and then it started working. I mean was getting values into array as expected.