Jon (LabKey DevOps) responded: |
2016-05-26 16:01 |
|
|
Leo Dashevskiy responded: |
2016-05-26 16:17 |
Jon, I made the SQL and the XML codes identical, except for the query name.
Still, the UI based one behaves differently than the file-based one, and I cannot obtain the container name (see the display column).
Thanks.
-Leo |
|
Jon (LabKey DevOps) responded: |
2016-05-26 16:26 |
Hi Leo,
Yes, I do see the query/table names are different, but I also see that your XML in the test version is missing the XML declaration as well.
<?xml version="1.0" encoding="UTF-8"?>
Although version 1.0 is optional to provide the declaration, I've seen odd behavior when it isn't included sometimes.
Can you add that line into your XML and give it another try?
Regards,
Jon |
|
Leo Dashevskiy responded: |
2016-05-26 16:41 |
Jon, I added the XML declaration to the XML metadata portion of the UI based "Test" query and that didn't make it return the same contents as the file based "GEE_studyCohortsInfo" one. |
|
Jon (LabKey DevOps) responded: |
2016-05-27 11:33 |
Thanks Leo,
Just wanted to make sure that both queries were as close as possible here.
Let me see if I can reproduce this locally on my end.
Thanks for your patience.
Regards,
Jon |
|
Jon (LabKey DevOps) responded: |
2016-05-27 22:12 |
|
|
|
Leo Dashevskiy responded: |
2016-05-31 09:02 |
Jon,
While I appreciate this piece of info (didn't know about the container scoping control within the customize view UI), the original main question was totally about something else: I am not able to pull in a column from the core.containers table (the table being looked up by the container column) into my own query. The column I need is the "Name" or "DisplayName", just the textual string of the container. Specifying "container.Name" as a column in my query results in an error, as noted above.
Please, help with addressing that.
Thanks.
-Leo |
|
Jon (LabKey DevOps) responded: |
2016-05-31 14:18 |
Hi Leo,
Since the XML metadata gets applied after the query is parsed, trying to use the Foreign Key defined in the XML on the same query you're authoring causes the field to not be available at the time of application. One way to get around it is to have your query use the Container.Name syntax rather than just Container if you need the name value to appear instead.
Regards,
Jon |
|
Leo Dashevskiy responded: |
2016-05-31 14:26 |
That's what I'm saying: using Container.Name does not work for me, it results in an error or may be I'm not understanding exactly, what you're saying.
Please, see for yourself: modify the "Test" query in such a way that it work and a simple textual string (not a link) with just the name of the container appear as a column in this query.
Thanks.
-Leo |
|
Matthew Bellew responded: |
2016-05-31 15:21 |
I believe the problem here has nothing to do with the XML, but the SQL. The difference is that the query that doesn't work explicitly selects "container.name", while the query that does work selects "container". Note, that the .xml file applies metadata to the _result_ of the query. So the lookup defined in the .xml is not available to the SQL in the .sql file. This explains why container.name is not valid.
Note that the lookup is available/known by the data region which is why the GEE_studyCohortsInfo grid displays name. |
|
Leo Dashevskiy responded: |
2016-05-31 15:30 |
Ok, Matt, thanks, so is there a -clean- way to pull in the container's name without JOIN-s or is that my only option then? |
|
Matthew Bellew responded: |
2016-05-31 15:52 |
Well, the real question is why isn't the "container" column in HM_InputSamplesQuery already a lookup? I think it's because it is defined as
mat.container.entityid as container,
rather than just
mat.container as container
If this column is defined as a lookup, then that definition should just carry though and your outer query should be able to select container.name.
Matt |
|
Leo Dashevskiy responded: |
2016-05-31 16:15 |
Kudos to Matt! ;)
I modified the source query snapshot HM_InputSamplesQuery to have the container column be not just a textual string, but a lookup to containers and now the cascading query using it can pull in any columns of the related table! |
|