labkey.getLookupDetails: Retrieve detailed information on a LabKey query

View source: R/labkey.getQueryInfo.R

labkey.getLookupDetailsR Documentation

Retrieve detailed information on a LabKey query

Description

Fetch a list of output columns and their attributes from the query referenced by a lookup field

Usage

labkey.getLookupDetails(baseUrl, folderPath,
    schemaName, queryName, lookupKey)

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

lookupKey

a string specifying the qualified name of a lookup field (foreign key) relative to the query specified by queryName

Details

When getQueryDetails returns non-NA values for the lookupQueryName, the getLookupDetails function can be called to enumerate the fields from the query referenced by the lookup. These lookup fields can be added to the colSelect list of selectRows.

Value

The available schemas are returned as a data frame, with the same columns as detailed in labkey.getQueryDetails

Author(s)

Peter Hussey, peter@labkey.com

See Also

labkey.selectRows, makeFilter, labkey.executeSql, labkey.updateRows, labkey.insertRows, labkey.importRows, labkey.deleteRows, labkey.getSchemas, labkey.getQueries, labkey.getQueryViews, labkey.getQueryDetails, labkey.getDefaultViewDetails

Examples

## Not run: 

## Details  of fields of a query referenced by a lookup field
# library(Rlabkey)

lu1  <- labkey.getLookupDetails(
	baseUrl="http://localhost:8080/labkey",
	folderPath="/apisamples",
	schemaName="lists",
	queryName="AllTypes",
	lookupKey="Category"
)
lu1

## When a lookup field points to a query object that itself has a lookup
## field, use a compound fieldkey consisting of the lookup fields from
## the base query object to the target lookupDetails, separated by
## forward slashes
lu2<- labkey.getLookupDetails(
	baseUrl="http://localhost:8080/labkey",
	folderPath="/apisamples",
	schemaName="lists",
	queryName="AllTypes",
	lookupKey="Category/Group"
)
lu2

## Now select a result set containing a field from the base query, a
## field from the 1st level of lookup, and one from the 2nd
rows<- labkey.selectRows(
	baseUrl="http://localhost:8080/labkey",
	folderPath="/apisamples",
	schemaName="lists",
	queryName="AllTypes",
	colSelect=c("DisplayFld","Category/Category","Category/Group/GroupName"), 
	colFilter = makeFilter(c("Category/Group/GroupName",
	   "NOT_EQUALS","TypeRange")), maxRows=20
 )
 rows


## End(Not run)

Rlabkey documentation built on Oct. 23, 2024, 5:06 p.m.