Overview
While its great to have access to an entire data set, readability is important too. To make the data more readable in a user interface, RDS allows users to limit the number of records and variables that are received. There are two ways to limit the output, users can limit the number of variables retrieved using the colLimit
parameter or limit the number of records that are returned by using the limit
parameter.
Limiting the output helps users to display data in a much more readable fashion, but it is worthless if there is no way to page through the data. Rich Data Services makes it easy for to scroll through the pages by using the colOffset
and offset
parameters. When data is returned it is accompanied by an "info" section that contains information about the current offsets and limits, and whether or not there are more columns or records available.
Panel | |
---|---|
On this page:
|
Step By Step
- Begin with a simple select query.
We will begin by looking at an example of the information returned by the simple select query. In this example it looks like this, yours may look different but should contain the same general information.
Code Block title Full Data Info { records: [...], info: { colOffset: 0, colCount: 67, moreCols: false, format: "MTNA", includeMetadata: false, limit: 20, offset: 0, moreRows: true } }
Paginating Columns
The view in this example has a total of 67 variables (columns) and has limited the records returned to 20 by default. To limit the columns use the colLimit parameter.
Code Block title Select Query Column Subset http://{host}/rds/{collection}/{view}/select?colLimit=10
Code Block title Info collapse true { records: [...], info: { colLimit: 10, colOffset: 0, colCount: 67, moreCols: true, format: "MTNA", includeMetadata: false, limit: 20, offset: 0, moreRows: true } }
Paging forward and backwards through the columns can be achieved by adjusting the colOffset parameter.
Code Block title Columns 11-20 http://{host}/rds/{collection}/{view}/select?colLimit=10&colOffset=10
Code Block title Columns 21-30 http://{host}/rds/{collection}/{view}/select?colLimit=10&colOffset=20
When the last group of 10 (columns 61-67) is retrieved the "moreCols" property will be false, a quick and easy indication for any UI that there are no more columns.
Code Block http://{host}/rds/{collection}/{view}/select?colLimit=10&colOffset=60
Code Block collapse true { records: [...], info: { colLimit: 10, colOffset: 60, colCount: 67, moreCols: false, format: "MTNA", includeMetadata: false, limit: 20, offset: 0, moreRows: true } }
Paginating Records
If developers want to see the count of total records for they view, the count parameter can be used.
Code Block title Get Total Record Count http://{host}/rds/{collection}/{view}/select?count
Code Block collapse true { records: [...], info: { colOffset: 0, colCount: 67, moreCols: false, format: "MTNA", includeMetadata: false, limit: 20, offset: 0, count: 662, moreRows: true } }
Record limits can be adjusted using the limit paramter.
Code Block title Select 100 Records http://{host}/rds/{collection}/{view}/select?limit=100
Records can be paginated using the offset parameter.
Code Block title Records 101-200 http://{host}/rds/{collection}/{view}/select?limit=100&offset=100
Code Block title Records 201-300 http://{host}/rds/{collection}/{view}/select?limit=100&offset=200
When the final records are reached the "moreRows" property will be returned as false.
Code Block title No More Records collapse true { records: [...], info: { colOffset: 0, colCount: 67, moreCols: false, format: "MTNA", includeMetadata: false, limit: 100, offset: 600, moreRows: false } }