Set offset for GlideRecord query

peter_repan
Tera Guru

Hi all,

I would like to create a custom table with pagination. I need to fill table with GlideRecord query.

I know that it is possible to use setLimit(int) function to get only requested number of rows, but it is somehow possible to set offset of this records, to be able to use pagination for fetching second, third... set of items ?

Example:

var gr = new GlideRecord('incident');

gr.skip(30); ----> how to do something like this ?

gr.setLimit(10);

gr.query();

1, 2, 3, 4, 5

---> will return fourth set of 10 records

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi Peter,



I think this is what you are looking for



gr.chooseWindow(10, 20);       // this will give you 10 records, starting form the 11th to 20th.



Real more here in depth


GlideRecord Glimmerings: Windows...


-Anurag

View solution in original post

16 REPLIES 16

Hi Harish,



I'm sorry but I do not understand your question.


See below Ex;



you have 10 records but you would like to send notification to only 4 users.



total records = 'A,B,C,D,E,F,G,H,I,J';



In the above total 10 records how you would you know i want to send only this below 4 records


'A,D,G,J'


It is simple. All the time I will have defined 'OrderBy' column.



So If I have paging 1,2,3 then on the first page I will have all the time A,B,C,D, on the second E,F,G,H and on the third I,J.


If i understand correct



your doing orderby


so you got 3 order


1-->A,B,C,D


2-->E,F,G,H


3-->I,J



So any way your sending mail to all 10 users.


I do not know why are you talking about sending e-mails to users. I did not mentioned anything about emails.


Please read my description at the top of the page. It has nothing in common with users or notifications.