Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

Table of Contents


Step By Step

  • Begin with a simple select query.
  • 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. 

      Code Block
      titleFull 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
      titleSelect Query Column Subset
      http://{host}/rds/api/catalog/{collection}/{view}/select?colLimit=10


      Code Block
      titleInfo
      collapsetrue
      {
      	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
      titleColumns 11-20
      http://{host}/rds/api/catalog/{collection}/{view}/select?colLimit=10&colOffset=10


      Code Block
      titleColumns 21-30
      http://{host}/rds/api/catalog/{collection}/{view}/select?colLimit=10&colOffset=20


    • When the last group of 10 (columns 61-67) is retrieved the "the moreCols" property  property will be false, a quick and easy indication for any UI that there are no more columns. 

      Code Block
      http://{host}/rds/api/catalog/{collection}/{view}/select?colLimit=10&colOffset=60


      Code Block
      titleNo More Columns
      collapsetrue
      {
      	records: [...],
      	info: {
      		colLimit: 10,
      		colOffset: 60,
      		colCount: 67,
      		moreCols: false, //This field is false because there are no more columns to return
      		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
      titleGet Total Record Count
      http://{host}/rds/api/catalog/{collection}/{view}/select?count


      Code Block
      titleTotal Record Count
      collapsetrue
      {
      	records: [...],
      	info: {
      		colOffset: 0,
      		colCount: 67,
      		moreCols: false,
      		format: "MTNA",
      		includeMetadata: false,
      		limit: 20,
      		offset: 0,
      		count: 662, // This field has been added to the info
      		moreRows: true
      	}
      }


    • Record limits can be adjusted using the limit paramter parameter

      Code Block
      titleSelect 100 Records
      http://{host}/rds/api/catalog/{collection}/{view}/select?limit=100


    • Records can be paginated using the offset parameter. 

      Code Block
      titleRecords 101-200
      http://{host}/rds/api/catalog/{collection}/{view}/select?limit=100&offset=100


      Code Block
      titleRecords 201-300
      http://{host}/rds/api/catalog/{collection}/{view}/select?limit=100&offset=200


    • When the final records are reached the "moreRows" property  property will be returned as false. 

      Code Block
      titleNo More Records
      collapsetrue
      {
      	records: [...],
      	info: {
      		colOffset: 0,
      		colCount: 67,
      		moreCols: false,
      		format: "MTNA",
      		includeMetadata: false,
      		limit: 100,
      		offset: 600,
      		moreRows: false // This field is now false
      	}
      }