While on the subject of defining domains in file-based modules, I have one more question. In the originally attached result.xml I would like the CellsUsed and ReactionPhase fields to be FK to a lookup. Is it possible to define lists in a file-based module? Or would I need to create a custom Schema for this module and write the DDL and DML statements to populate it in the module's SQL scripts? I would prefer to use lists, I don't want to restriction what the values can be and rather have the user of the assay define it as they wish.
I see in customeModules for idri visual assay's result.xml has some PropertyDescriptors with FK to list.Timepoints and lists.Temperature; however, I don't see where the list is defined in the idri module source. If the list doesn't exist does it create it?
Thanks,
Anthony |
Unfortunately, no, it's not possible to define lists in file-based modules yet. It's something we've been wanting to do, but it's a little tricky to deal with schema changes and attaching the list to containers.
There are two options to workaround this limitation:
1) Use a folder or list archive and manually import it into the target folder. This lets you manage the data and design in source control, but still allows you to modify the design once imported.
2) Use a file-based module with sql scripts as you suggest. To insert data, either use SQL DML scripts or create an initialize.html view that will populate a table using LABKEY.Query.insertRows().
If you use (2) and you'd like to allow admins to add/remove fields from the table, you can add an LSID column to your hard-table and make it a foreign key to the exp.Object.ObjectUri column in the schema.xml file. This will allow you to define a domain for the table much like a list. The domain is per-folder so different containers may have different sets of fields.
For an example of how to do this, check out the server/customModules/reagent module's reagent.xml file. If wires up the LSID lookup to the exp.Object.ObjectUri column and adds an "Edit Fields" button that opens the domain editor.
<ns:column columnName="Lsid">
<ns:datatype>lsidtype</ns:datatype>
<ns:isReadOnly>true</ns:isReadOnly>
<ns:isHidden>true</ns:isHidden>
<ns:isUserEditable>false</ns:isUserEditable>
<ns:isUnselectable>true</ns:isUnselectable>
<ns:fk>
<ns:fkColumnName>ObjectUri</ns:fkColumnName>
<ns:fkTable>Object</ns:fkTable>
<ns:fkDbSchema>exp</ns:fkDbSchema>
</ns:fk>
</ns:column>
function editDomain(queryName)
{
var url = LABKEY.ActionURL.buildURL("property", "editDomain", null, {
domainKind: "ExtensibleTable",
createOrEdit: true,
schemaName: "reagent",
queryName: queryName
});
window.location = url;
} |