Sharing/joining datasets between folders

General Server Forum (Inactive)
Sharing/joining datasets between folders Karen Bates  2019-11-05 11:53
Status: Closed
 

Hello,

I would like to join tables from data sets across sub-folders within a project. The below link describes a folder filter option when selecting the Grid option on a data set to customize a grid with a table from another folder, but I'm not seeing that option when I open any of my grids. Is that feature only available in certain folder types or for select data sets?

https://www.labkey.org/Documentation/wiki-page.view?name=filterByFolder

Is the Shared Project folder the best way to share a data set across sub-folders?

Thank you!
Karen

 
 
Jon (LabKey DevOps) responded:  2019-11-22 11:50
Hi Karen,

There are several different ways to do JOINs. Utilizing Folder Filters will only work if you have access across the various containers you want to include in the filtering. This Folder Filter should be available on any Query you create, not on dataset tables.

Have you tried to create a query based on a dataset, then look for the Folder Filter?

Regards,

Jon
 
Karen Bates responded:  2019-12-03 08:48
Hi Jon,

Thank you for the reply! I'm working on a query at the moment and I'm running into another issue. The two data sets I am attempting to join have matching ParticipantID's but some of the dates don't match. I trying to use conditional statements to join the two on the ParticipantID where the dates either match or are within 7 days of each other for example. However, it seems like LabKey is automatically matching the two tables based on both the ParticipantID and the date column? Is it because this is a date-based study and the ParticipantID and date are the keys to the data sets?

Can a join be executed based solely on ParticipantID or is LabKey taking the date into account to match as well?

Thank you for your help!
 
Jon (LabKey DevOps) responded:  2019-12-18 15:47
Hi Karen,

Yes, so studies use a combination of the participantId and either the date or the visit value together as a primary key for the dataset (date-based studies using the date field and the participantId, visit-based studies using visit and the participantId).

The only way a participantId can solely be used as an identifier in a dataset is when the dataset is a demographics dataset. A Demographics dataset only allows one row per participant (see more details here: https://www.labkey.org/Documentation/wiki-page.view?name=setUpDatasets)

However, this will only work solely on the dataset if every row you have in your dataset only has one participant per row, so no duplicate participants can be in that dataset.

Also, depending on what kind of JOIN you're doing, this can create odd results in a query, so you need to figure out what kind of results you're expecting to produce and how the data should lay out. For example, a LEFT JOIN isn't the same thing as a JOIN or a RIGHT JOIN.

Regards,

Jon