Query Selector Checkboxes on JOINED Query

LabKey Support Forum
Query Selector Checkboxes on JOINED Query simon buckner  2018-05-09 07:48
Status: Closed
 
Hello,

I came across this post: https://www.labkey.org/home/Support/Developer%20Forum/announcements-thread.view?entityId=0af653dc-8023-1030-aaa0-987439a6474a

...which indicates that selectors are not shown for queries that use JOIN statements. However, it is fives years old, so I figured I would make a new thread.

We have a query view, and we would like to be able to select the rows. This query includes a JOIN statement, and as a result, does not seem to have a primary key. I thought this was because the joined queries might return duplicate primary keys, but it looks like the presence of a JOIN statement at all hides the selectors. Is this the case, and if so, is there a workaround at this time?

Thanks,

Simon
 
 
Jon (LabKey DevOps) responded:  2018-05-18 15:12
Hi Simon,

Unfortunately, this appears to is still be the case. A JOIN or a UNION will not render selectors in a custom query by default.

What kind of work are you trying to utilize the selectors for on your JOINed query?

Regards,

Jon
 
Ben Bimber responded:  2018-05-18 15:21
I believe if you edit the metadata (you might need to add XML metadata) you can either specify one of the columns as a primary key (which will result in selectors, i think), or you can set alwaysShowRecordSelectors=true. I think any of the three things below would do it (see comments inline):

<tables xmlns="http://labkey.org/data/xml">
    <table tableName="" tableDbType="TABLE">
       <!--I think this alone will do it-->
        <pkColumnName>MyColumn</pkColumnName>
        <columns>
            <!--Another way to do the same thing as above-->
            <column columnName="MyColumn">
                <isKeyField>true</isKeyField>
            </column>
        </columns>
       <!--and I think this will force it even w/o a primary key-->
        <buttonBarOptions alwaysShowRecordSelectors="true">
        </buttonBarOptions>
    </table>
</tables>