R: Retrieve a list of available named views defined on a query...

labkey.getQueryViews {Rlabkey} | R Documentation

## Retrieve a list of available named views defined on a query in a schema

### Description

Fetch a list of named query views available to the current user in a specified folder context, schema and query

### Usage

    labkey.getQueryViews(baseUrl, folderPath, schemaName, queryName)

### Arguments

`baseUrl` | a string specifying the address of the LabKey Server, including the context root
`folderPath` | a string specifying the hierarchy of folders to the current folder (container) for the operation, starting with the project folder
`schemaName` | a string specifying the schema name in which the query object is defined
`queryName` | a string specifying the name the query

### Details

Queries have a default “view” associeated with them, and can also have any number of named views. A named query view is created by using the “Customize View” button option on a LabKey data grid page. Use `getDefaultViewDetails` to get inforation about the default (unnamed) view.

### Value

The available views for a query are returned as a three-column data frame, with one row per view output field.

`viewName` The name of the view, or NA for the default view.
`fieldName` The name of a field within the view, as defined in the query object to which the field belongs
`key` The name of the field relative to the base query, Use this value in the colSelect parameter of `labkey.selectRows()` .

### Author(s)

Peter Hussey, peter@labkey.com

### References

https://www.labkey.org/Documentation/wiki-page.view?name=savingViews

### See Also

Retrieve data: `labkey.selectRows`,`makeFilter`, `labkey.executeSql`
Modify data: `labkey.updateRows`, `labkey.insertRows`, `labkey.importRows`, `labkey.deleteRows`
List available data: `labkey.getSchemas`, `labkey.getQueries`, `labkey.getQueryDetails`,`labkey.getDefaultViewDetails`,`labkey.getLookupDetails`

### Examples

    ## List of views defined for a query in a schema
    # library(Rlabkey)

    viewsDF <- labkey.getQueryViews(
    	baseUrl="http://localhost:8080/labkey",
    	folderPath="/apisamples",
    	schemaName="lists",
    	queryName="AllTypes"
    )

[Package Rlabkey version 2.7.0 Index]