Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 11 Next »

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. 

On this page:

Information Returned

  • 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. 

    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.

    Select Query Column Subset
    http://{host}/rds/{collection}/{view}/select?colLimit=10
    Info
    {
    	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.

    Columns 11-20
    http://{host}/rds/{collection}/{view}/select?colLimit=10&colOffset=10
    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. 

    http://{host}/rds/{collection}/{view}/select?colLimit=10&colOffset=60
    No More Columns
    {
    	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. 

    Get Total Record Count
    http://{host}/rds/{collection}/{view}/select?count
    Total Record Count
    {
    	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. 

    Select 100 Records
    http://{host}/rds/{collection}/{view}/select?limit=100
  • Records can be paginated using the offset parameter. 

    Records 101-200
    http://{host}/rds/{collection}/{view}/select?limit=100&offset=100
    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. 

    No More Records
    {
    	records: [...],
    	info: {
    		colOffset: 0,
    		colCount: 67,
    		moreCols: false,
    		format: "MTNA",
    		includeMetadata: false,
    		limit: 100,
    		offset: 600,
    		moreRows: false
    	}
    }
  • No labels