Select fields from all datasets (study) with a custom query

LabKey Support Forum (Inactive)
Select fields from all datasets (study) with a custom query Greg Taylor  2014-08-21 16:01
Status: Closed
 
Hi Trent,

In your most recent example, the metadata is not applied which is consistent with the documentation. Currently, this option is only available if the query has been specified through config.sql. In your example, the query is specified by schemaName/queryName is therefore the metadata is not applied. I experimented with a script that uses config.sql and found that the metaData was applied properly.

Greg

Below is the documentation for this feature:

{Object} config.metadata
Metadata that can be applied to the properties of the table fields. Currently, this option is only available if the query has been specified through the config.sql option. For full documentation on available properties, see LabKey XML Schema Reference. This object may contain the following properties:
type: The type of metadata being specified. Currently, only 'xml' is supported.
value: The metadata XML value as a string. For example: '<tables xmlns="http://labkey.org/data/xml"><table tableName="Announcement" tableDbType="NOT_IN_DB"><columns><column columnName="Title"><columnTitle>Custom Title</columnTitle></column></columns></table></tables>'

A similar example script that applies the xml metadata:
<script type="text/javascript">
    var dummyWebPart =
        new LABKEY.QueryWebPart({
                renderTo: 'container',
                title: 'Dummy',
                schemaName: 'study',
                //queryName: 'Dummy',
                sql: 'SELECT * FROM study.Dummy',
                showRecordSelectors: true,
                buttonBar: {
                    includeStandardButtons: true,
                    items:[
                      {text: 'Show Vials', onClick: "console.log(dummyWebPart.getDataRegion().getChecked())", requiresSelection: true},
                    ]
                },
                metadata: {
                    type: 'xml',
                    value: '<tables xmlns="http://labkey.org/data/xml"><table tableName="Dummy" tableDbType="NOT_IN_DB"><columns><column columnName="lsid"><isKeyField>false</isKeyField></column><column columnName="ParticipantSequenceNum"><isKeyField>true</isKeyField></column><column columnName="ABC"><columnTitle>ABD</columnTitle><isKeyField>true</isKeyField></column></columns></table></tables>'
                }
                 
        });
</script>
<div id="container"></div>