- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2017 03:12 PM
Running this exact code the count is always coming back as 500, but it should be > 2454 records. If I look at the table the count is
Any insight as to why this isn't returning the full set of names would be appreciated.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading ) {
return;
}
var idz = getDepts();
}
function getDepts() {
var gr = new GlideRecord('u_badg_somrollup');
gr.addQuery('u_deptname' );
gr.query();
var deptNames =[];
i=-1;
while(gr.next()) {
i++;
deptNames[i]=gr.u_deptname;
}
alert ("Returned Count: " + deptNames.length); // 500
return deptNames;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017 01:22 AM
Glenn, your query uses the following WHERE clause:
gr.addQuery('u_deptname' );
Without a value there it means WHERE clause would be something like:
SELECT * FROM u_badg_somrollup WHERE u_deptname IS NULL;
Is this something you wanted on purpose?
Running this in Background scripts should give you the exact count you are getting:
var gr = new GlideRecord('u_badg_somrollup');
gr.addQuery('u_deptname' );
gr.query();
gs.print(gr.getRowCount());
If you had in mind a value for "u_deptname" the your query should look like:
gr.addQuery('u_deptname', <value>);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017 09:21 AM
Yes, this was part of the problem. I had assumed excluding the operator and value meant it would return everything.
This worked better with gr.addQuery('u_deptname','DOES NOT CONTAIN', '').
Oddly enough, gr.addNotNullQuery('u_deptname') would not run.
However, the result set is still maxed out at 500 records (possibly a platform limit set by our administrator?) from a set that should have > 700 records.
So, I think Pradeep may be right that I need to look into using GlideAjax for this. Having no knowledge of GlideAjax or Script Includes at this point, I feel like I'm playing Serena Williams without having a backhand.
Thank you for your insight on this !
-G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017 02:31 AM
Hey Glenn,
If you just need the row count could you please try the below way :
var gr = new GlideRecord("u_badg_somrollup");
gr.query();
if(gr.next())
{
alert("Count is::"+gr.getRowCount());
}
Let me know if this was helpful/correct
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017 09:23 AM
I need a query that will return all 700+ department names.
Your script works fine, but I may have sprained my finger clicking through those alerts before I reach the end.
Thank you for your suggestion.
-G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2017 01:28 PM
There was an issue with one data record in the set. Once I remove that record the queries worked as expected.
-G