Limit the number of Records display on Report ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2014 06:58 AM
I have created a report, but on home page its showing the n number of records , but i want it show only the first 5 records.
i have restrict the record form the list layout, but it was applicable to all of the table.
is there any method so we can restrict the number of record to 5 only.
Thanks
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2014 07:06 AM
Hi Shashank,
Apart from the first 5 records, is there any other condition also working on this report?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2014 07:43 AM
its should show the latest 5 record and report runs in every 30 min.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2014 07:57 AM
in that case apply a filter on the replort like this
<field> <is> <javascript: new my_script_include().runReport() >
here field is any string field
now on your script include you can write your own Glide Record to return any thing and you can limit it to 5
What i did was this:
report filter
<number><is one of> <javascript: new my_script_include().runReport()>
script include code
runReport: function()
{
var x=[];
var gr = new GlideRecord("pm_project");
gr.addQuery("name", "test");
gr.setLimit('5');
gr.query();
while (gr.next()) {
x.push(gr.getValue('number'));
}
return x;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2016 08:58 PM
Hi Anurag,
i tried with your solution, My script include is working fine.
But however when i add it to the filter condition of the Report.
No records are being displayed in the report.
Could you please suggest what could be the issue
javascript: new my_script_include().runReport();
script include:
var my_script_include = Class.create();
my_script_include.prototype = {
initialize: function() {
},
runReport : function()
{
var x=[];
var gr = new GlideRecord("change_request");
gr.addQuery("active", "true");
gr.setLimit('5');
gr.query();
while (gr.next()) {
x.push(gr.getValue('number'));
}
return x;
},
type: 'my_script_include'
};