I have two file based modules and they both contain hard tables that they automatically generate via sql scripts within each module. I also have xml metadata defined for both hard tables in the modules. I have a single project, /home, and each module are in a different folder within home - /home/folder1 and /home/folder2. Module2 in folder2 contains a hard table, table2, that has a lookup in a hard table, table1, within Module1 in folder1. If I directly connect to my DB and look at the table structure, everything including the foreign keys exist and look good. When I view the table2 schema in the labkey schema browser, the lookup column is empty for this field. But when I use the labkey schema browser to edit the table2 metadata, then the lookup appears to exist. When I view table2 data in labkey, the lookup field into table1 displays the integer values. When I try to insert a new row into table2 using labkey, I get a text entry box and not a drop down menu for the lookup field in question.
I thought because I put both of my modules under the same project, they would be able to access each others tables. Is this incorrect? Do they need to be in the same folder? Or do I need to make use of the 'shared' project? I tried adding metadata for the foreign key, but nothing changed.
thanks,
-Will |
|
Will Holtz responded: |
2015-09-09 13:32 |
It appears that I need to active both Module1 and Module2 in /home and then create my assay design instances in /home/folder1 or /home/folder2, then the foreign keys work. However, if I take my existing configuration described in the parent post and now activate Module1 and Module2 in /home (after they were previously activated /home/folder1 and /home/folder2), then the cross-module foreign key does not work. I don't understand why that does not work, but I'm not too surprised.
-Will |
|
Jon (LabKey DevOps) responded: |
2015-09-09 14:50 |
Hi Will,
Just to clarify, you had the XML Metadata defined within each module, but that doesn't appear to be picking up. Is that correct?
When you accessed the two tables, were you able to manually create the lookups to the other respective folder and table via the Schema Browser?
My understanding is that you shouldn't need to add the module to the parent project to allow the modules in the folders to pick each other up if the Metadata is already defined correctly.
Regards,
Jon |
|
Will Holtz responded: |
2015-09-09 15:21 |
Hi Jon,
Initially I had metadata for the lookup column with just:
<column columnName="product"></column>
and later I tried:
<column columnName="product">
<fk>
<fkFolderPath>/home/folder1</fkFolderPath>
<fkTable>Table1</fkTable>
<fkDbSchema>Schema1</fkDbSchema>
</fk>
</column>
Neither of these resulted in a functional lookup within labkey.
If I edit the metadata from within the labkey schema browser, it appears to already have the lookup configured, as the 'Type' column shows the fk schema and table. However, if I try to edit the lookup, the 'Choose Field' dialog has the value for schema, but doesn't have values for Folder or Table (they say 'Folder' and 'no tables found'). If I then set Folder to /home/Module1, I can then select the table. If I save this and go back to the schema browser, the lookup column is still empty for this field, and when I view the data, I see the integer values for this column.
thanks for you help!
-Will |
|
Will Holtz responded: |
2015-09-09 15:26 |
One more thing I just noticed. When I try to manually edit the lookup with the 'Choose Field' dialog, it loads with the correct schema value. But if I look at the drop down list for schema names, the schema isn't listed there.
-Will |
|
Will Holtz responded: |
2015-09-11 10:11 |
I figured my issue out. Module2, with the lookup to Module1, was not declaring a module dependency (in the module.properties file) on Module1. Once I added the dependency, turning on Module2 in a folder forces Module1 to also be active in that folder and thus the Module1 hard table is accessible from within Module2.
-Will |
|
|
|