For certain LabKey queries, including assay designs, issue trackers, and survey designs, but not including study datasets, the scope of the query can be set with a folder filter
- all data on the site
- all data for a project
- only data located in particular folders
For example, the query itself can be defined at the project level. Data it queries may be located within individual subfolders. Scope is controlled using the "Filter by Folder" option on the
(Grid Views) menu in the web part.
Note that there are many mechanisms for controlling data scope in LabKey Server. To learn about other methods, see Controlling Data Scope
This allows you to organize your data in folders that are convenient to you at the time of data collection (e.g., folders for individual labs or lab technicians). Then you can perform analyses independently of the folder-based organization of your data. You can analyze data across all folders, or just a branch of your folder tree.
You can set the scope through either the (Grid Views)
menu or through the client API. In all cases, LabKey security settings remain in force, so users only see data in folders they are authorized to see.
Folder Filters in Grid Interface
To filter by folder through the user interface:
- Select (Grid Views) > Filter by Folder.
- Choose one of the options:
- Current folder
- Current folder and subfolders
- All folders (on the site)
The LabKey API provides developers with even finer grained control over the scope.
config property is available on many methods on such as LABKEY.Query.selectRows
, provides fine-grained control over which folders are accessed through the query.
For example, executeSQL
allows you to use the containerFilter parameter to run custom queries across data from multiple folders at once. A query might (for example) show the count of NAb runs available in each lab’s subfolder if folders are organized by lab.Possible values for the containerFilter
Folder Filters with the JDBC Driver
The LabKey JDBC Driver also supports the containerFilter
parameter for scoping queries by folder. Learn more in this topic:
Container Filter in LabKey SQL
Within a LabKey SQL FROM clause, you can include a containerFilter to control scope of an individual table within the query. Learn more in this topic: