i m using glideAggregate to fetch data from one table that table data are already stored in on array

mahi6
Tera Contributor

data.t =[];

var g = new GlideAggregate('table');

g.addQuery('name','IN','data.array');

g.query()

while(g.next())

{

var k ={};

k.n1 = g.name.toString();

data.t.push(k);

}

 

i m getting blank no data is fetch from table.how to do 

2 REPLIES 2

suvro
Mega Sage
Mega Sage

I dont understand the use case. You already have names in an array. And again pushing the names in an array? And you could use GlideRecord, there is no use of GlideAggregate here

 

data.t =[];

var g = new GlideAggregate('table');

g.addQuery('sys_id','IN','data.array');

g.query()

while(g.next())

{

var k ={};

k.n1 = g.name.toString();

data.t.push(k);

}

Ian Mildon
Tera Guru

Change the GlideAggregate to GlideRecord and see if you start getting the data you're expecting.

GlideAggregate is designed for providing a count of the "matching" records; but your script is missing part of the GlideAggregate functions. This makes it look like it should be a GlideRecord which will return records/data from records