- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2021 07:39 AM
I have a table with 10000 records. I need to retrieve all the data from table and show it in UI page. I add pagination in the UI page(it shows only 50 records in the first page). As of now i wrote a query to retrieve all the records from the table and show only 50 records per page.
var gr=new GlideRecord(table_name);
gr.addQuery(some query here to fetch the data which satisfy the given given condition);
gr.query(); //It fetches all the records which satisfy the condition given in addquery
gr.chooseWindow(1,50); // It helps to get the records with the query
gr.query();
Here my problem is it takes some time to fetch the records and show it in UI page[performance issue is there]. To overcome the issue i want something like that.
var gr=new GlideRecord(table_name);
gr.addQuery(some query here to fetch the data which satisfy the given given condition);
gr.chooseWindow(1,50);
gr.query();
I need to fetch only the data given in the limit. Any possible way to do it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2021 09:45 PM
Hi
chooseWindow() only makes sense in combination with setLimit(). And please note that numbering of chooseWindow() starts with "0" (not "1"!).
So the result for querying the first 50 records would be as follows:
var gr=new GlideRecord(table_name);
gr.chooseWindow(0, 49);
gr.setLimit(50);
gr.query();
Kind regards
Maik
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2021 09:45 PM
Hi
chooseWindow() only makes sense in combination with setLimit(). And please note that numbering of chooseWindow() starts with "0" (not "1"!).
So the result for querying the first 50 records would be as follows:
var gr=new GlideRecord(table_name);
gr.chooseWindow(0, 49);
gr.setLimit(50);
gr.query();
Kind regards
Maik
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2024 08:07 AM
SetLimit alongwith choosewindow is not providing the correct result

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2021 04:37 AM
Hi,
Go through this link. This should help you.
Mark the comment as a correct answer and helpful if this helps to solve the problem.