cross-folder query camillesultana  2017-10-30 12:05
Status: Closed
 
Hello,

I am unable to generate cross-folder queries, which seems like it should be very straightforward to do. I keep generating errors despite following the instructions found here https://www.labkey.org/Documentation/wiki-page.view?name=crossFolderQueries.

I currently have three folders under my "Home" folder: CAICEdata, PratherData, and GrassianData. I have generated some test lists and sample sets in both of these and would like to generate queries on these tables that are displayed in CAICEdata. For example I have a sample set in GrassianData named GrassianTest, with field names Name, SampleLabel, SampleType, and SamplePhase. I navigate to CAICEdata, go to the Schema browser, and try to generate a very simple cross folder query with the following source code

SELECT Project."GrassianData".samples.GrassianTest.Name
FROM Project."GrassianData".samples.GrassianTest

To which I receive the following error
Error on line 1: Count not resolve column Project/GrassianData/samples/GrassianTest/Name

I've tried mixing this up and how gotten the following results

SELECT Project."GrassianData/".samples.GrassianTest.Name
FROM Project."GrassianData/".samples.GrassianTest
Error on line 1: Count not resolve column Project/GrassianData$S/samples/GrassianTest/Name

SELECT "Home/GrassianData".samples.GrassianTest.Name
FROM "Home/GrassianData".samples.GrassianTest
Error on line 2: Query or table not found: Home/GrassianData.samples.GrassianTest

SELECT "home/GrassianData".samples.GrassianTest.Name
FROM "home/GrassianData".samples.GrassianTest
Error on line 2: Query or table not found: home/GrassianData.samples.GrassianTest

SELECT "/home/GrassianData".samples.GrassianTest.Name
FROM "/home/GrassianData".samples.GrassianTest
Error on line 1: Could not resolve column: $Shome$SGrassianData/samples/GrassianTest/Name

I would really appreciate any insight into what is going on here. It seems like this should be very straightforward from the documentation, but I just can't get it to work.

Thanks!
Camille

Operating system: Windows 7
Browser: Chrome
Labkey: 17.20
 
 
camillesultana responded:  2017-10-30 17:53
I figure this out.

To be able to do the cross-folder query, you don't put the full path in the SELECT terms, only for the FROM term. So for the situation I described, the following query works.

SELECT GrassianTest.Name
FROM Project."GrassianData/".samples.GrassianTest