Limit the number of Records display on Report ?

shashankverma05
Tera Contributor

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.

 

find_real_file.png

 

Thanks

8 REPLIES 8

tammyz
Kilo Explorer

I am also looking for this same type of report. Need to limit the # of records displayed to 5 only. If this script didn't work then what is the answer.


Hi Tammy,



The script works with slight tweak, please find below script written on change management to limit report records to 5 entries



Script Include:   Name: my_script_include


API Name: global.my_script_include


Client Callable : true



--------------------------------------------------------------------------------------------------------


var my_script_include = Class.create();


my_script_include.prototype = Object.extendsObject(AbstractAjaxProcessor, {


  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'


});


---------------------------------------------------------------------------------------------------------------



Report Condition should be based on the returning parameter, in above case it is Change id (number)



ID   is one of   javascript:   new my_script_include().runReport()


find_real_file.png



Please hit like or mark helpful !



thanks,


Abhishek


Fab
Kilo Explorer

Old topic, but I'm looking for something like that to. 

I'm willing to report the last 5 KB Article from table knowledge ordered by published date. In comon language, I want to display a list of the 5 most recent published article. In SQL this would be done with ending the SQL request with the LIMIT 0,5 parameter. 

Unfortunately, I don't find no where in the forums/google any clue how to do this locally. I don't want to use the global list control option. 

Any luck here ? 

Fab
Kilo Explorer

Forgot to mention : GUI based solution, of course. 

 

thanks guys.