Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.labkey.remoteapi.query
Class SelectRowsCommand

    java.lang.Object
      org.labkey.remoteapi.Command<ResponseType>
          org.labkey.remoteapi.query.BaseQueryCommand<SelectRowsResponse>
              org.labkey.remoteapi.query.SelectRowsCommand

All Implemented Interfaces:
  BaseSelect

    public class SelectRowsCommand

extends BaseQueryCommand<SelectRowsResponse>
implements BaseSelect

Command for selecting data from any LabKey schema/query exposed on the server identified by the Connection object supplied to the `Command.execute(org.labkey.remoteapi.Connection, String)` method.

All data exposed from a LabKey Server is organized into a set of queries contained in a set of schemas. A schema is simply a group of queries, identified by a name (e.g., 'lists' or 'study'). A query is particular table or view within that schema (e.g., 'People' or 'Peptides'). For purposes of selecting, a query may be either a base table or a view that joins data between related tables.

To view the schemas and queries exposed in a given folder, add a Query web part to your portal page and choose the option "Show the list of tables in this schema" in the part configuration page. Alternatively, if it is exposed, click on the Query tab across the top of the main part of the page.

Example:

``

         Connection cn = new Connection("https://labkey.org");
         SelectRowsCommand cmd = new SelectRowsCommand("study", "Physical Exam");
         SelectRowsResponse response = cmd.execute(cn, "Home/Study/demo");
         for(Map<String,Object> row : response.getRows())
         {
             System.out.println(row.get("ParticipantId") + " weighs " + row.get("APXwtkg"));
         }

Nested Class Summary

Nested classes/interfaces inherited from class org.labkey.remoteapi.Command
`Command.CommonParameters`

Field Summary

Fields inherited from class org.labkey.remoteapi.query.BaseQueryCommand
`_containerFilter, _filters, _maxRows, _offset, _sorts`

Fields inherited from class org.labkey.remoteapi.Command
`CONTENT_TYPE_JSON`

Constructor Summary
`SelectRowsCommand(SelectRowsCommand source)` Constructs a new SelectRowsCommand that is a copy of the source command
`SelectRowsCommand(java.lang.String schemaName, java.lang.String queryName)` Constructs a new SelectRowsCommand for the given schema and query name.

Method Summary
`SelectRowsCommand` | `copy()` Returns a copy of this object.
`protected SelectRowsResponse` | `createResponse(java.lang.String text, int status, java.lang.String contentType, org.json.simple.JSONObject json)` Overridden to create a SelectRowsResponse object.
`java.util.List<java.lang.String>` | `getColumns()` Returns the explicit column list to be requested, or null if the default set of columns will be requested.
`java.util.Map<java.lang.String,java.lang.Object>` | `getParameters()` Returns the current parameter map, or null if a map has not yet been set.
`java.lang.String` | `getQueryName()` Returns the query this command will request.
`java.lang.String` | `getSchemaName()` Returns the current schema name this command will query.
`java.lang.String` | `getViewName()` Returns the current saved view name this command will request.
`boolean` | `isExtendedFormat()` Returns whether the extended format will be requested.
`void` | `setColumns(java.util.List<java.lang.String> columns)` Sets an explicit list of columns to request.
`void` | `setExtendedFormat(boolean extendedFormat)` Set to true to request the extended response format, which includes URLs, Missing-Value indicators and display values in addition to the raw values.
`void` | `setQueryName(java.lang.String queryName)` Sets the query name this command will request.
`void` | `setSchemaName(java.lang.String schemaName)` Sets the schema name this command will query.
`void` | `setViewName(java.lang.String viewName)` Sets a particular saved view to request.

Methods inherited from class org.labkey.remoteapi.query.BaseQueryCommand
`addFilter, addFilter, addSort, addSort, getContainerFilter, getFilters, getMaxRows, getOffset, getSortQueryStringParam, getSorts, setContainerFilter, setFilters, setMaxRows, setOffset, setSorts`

Methods inherited from class org.labkey.remoteapi.Command
`createMethod, execute, getActionName, getActionUrl, getControllerName, getHttpMethod, getParamValueAsString, getQueryString, getRequiredVersion, getTimeout, setParameters, setRequiredVersion, setTimeout`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.labkey.remoteapi.query.BaseSelect
`execute, getContainerFilter, getMaxRows, getOffset, getRequiredVersion, setContainerFilter, setMaxRows, setOffset, setRequiredVersion`

Constructor Detail

### SelectRowsCommand

    public SelectRowsCommand(java.lang.String schemaName,
                             java.lang.String queryName)

  Constructs a new SelectRowsCommand for the given schema and query name.

  Parameters:
    `schemaName` - The schema name.
    `queryName` - The query name.

### SelectRowsCommand

    public SelectRowsCommand(SelectRowsCommand source)

  Constructs a new SelectRowsCommand that is a copy of the source command

  Parameters:
    `source` - The source command

Method Detail

### setExtendedFormat

    public void setExtendedFormat(boolean extendedFormat)

  Set to true to request the extended response format, which includes URLs, Missing-Value indicators and display values in addition to the raw values. Use the getRowset() method on the response to iterate over the returned rows in a format-neutral manner.

  Parameters:
    `extendedFormat` - True to get the extended format.

### isExtendedFormat

    public boolean isExtendedFormat()

  Returns whether the extended format will be requested. See setExtendedFormat() for details.

  Returns:
    true if extended format will be requested.

### getSchemaName

    public java.lang.String getSchemaName()

  Returns the current schema name this command will query.

  Returns:
    The schema name.

### setSchemaName

    public void setSchemaName(java.lang.String schemaName)

  Sets the schema name this command will query.

  Parameters:
    `schemaName` - The new schema name.

### getQueryName

    public java.lang.String getQueryName()

  Returns the query this command will request.

  Returns:
    The current query name.

### setQueryName

    public void setQueryName(java.lang.String queryName)

  Sets the query name this command will request.

  Parameters:
    `queryName` - The new query name.

### getViewName

    public java.lang.String getViewName()

  Returns the current saved view name this command will request.

  Returns:
    The view name, or null if the default view will be requested.

### setViewName

    public void setViewName(java.lang.String viewName)

  Sets a particular saved view to request. Users may create specific views of any given query and save them under a name. Calling this method with a particular name will cause the command to request the saved view instead of the query's default view.

  Parameters:
    `viewName` - The view name, or null to request the default view.

### getColumns

    public java.util.List<java.lang.String> getColumns()

  Returns the explicit column list to be requested, or null if the default set of columns will be requested.

  Returns:
    The column list or null.

### setColumns

    public void setColumns(java.util.List<java.lang.String> columns)

  Sets an explicit list of columns to request. To refer to columns in a related table, use the syntax foreign-key-column/related-column (e.g., 'RelatedPeptide/Protein');

  Parameters:
    `columns` - The explicit column list, or null to request the default set of columns.

### createResponse

    protected SelectRowsResponse createResponse(java.lang.String text,
                                                int status,
                                                java.lang.String contentType,
                                                org.json.simple.JSONObject json)

  Overridden to create a SelectRowsResponse object.

  Overrides:
    `createResponse` in class `Command<SelectRowsResponse>`
  Parameters:
    `text` - The response text
    `status` - The HTTP status code
    `contentType` - The Content-Type header value.
    `json` - The parsed JSONObject (or null if JSON was not returned).
  Returns:
    A SelectRowsResponse object.

### getParameters

    public java.util.Map<java.lang.String,java.lang.Object> getParameters()

  Description copied from class: `Command`
  Returns the current parameter map, or null if a map has not yet been set. Derived classes will typically override this method to provide a parameter map based on data members set by specialized setter methods.

  Overrides:
    `getParameters` in class `BaseQueryCommand<SelectRowsResponse>`
  Returns:
    The current parameter map.

### copy

    public SelectRowsCommand copy()

  Description copied from class: `Command`
  Returns a copy of this object. Derived classes should override this to copy their own data members

  Overrides:
    `copy` in class `Command<SelectRowsResponse>`
  Returns:
    A copy of this object

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD