Assays and Simple Modules

LabKey Support Forum (Inactive)
Assays and Simple Modules dho  2009-05-12 17:26
Status: Closed
 
Hi:

I've been playing around with Simple Modules for the last few days. Is there any chance the documentation at:

https://www.labkey.org/wiki/home/Documentation/page.view?name=moduleassay

will be updated?

Also, I've been able to create custom HTML views within the Simple Modules. I apologize if this is a naive/simple question, but is there a way to execute a query and get the results as an array that can be manipulated outside of the grid view (i.e., in a customized HTML/Javascript page that would be part of a simple module).

Thanks in advance,

dave
 
 
eknelson responded:  2009-05-12 18:29
Hi Dave,

For the first part of your question: I just updated the doc page for module-based assays with the following:

"Until the documentation is complete, you may find the specification (http://docs.google.com/Doc?id=ddg8fts2_83qmgvh6gq) for this feature helpful. Please note that the specification may not be fully updated to match the final implementation."

I'm still catching up on documenting 9.1 features, so it will be a while longer before the doc page is complete.

Thanks,

Elizabeth
 
marki responded:  2009-05-12 23:16
As a temporary measure I have attached the overview spec of the general module framework written by Dave Stearns. He writes very clearly but this may not be perfectly up to date.

In terms of querying data you'll want to start with the LabKey Javascript API page here:

https://www.labkey.org/wiki/home/Documentation/page.view?name=javascriptAPIs

and end up on the specific selectRows API call here:

https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.Query.html#selectRows

Here's the simplest example of how to create a select box using HTML and script. In this example there's a list in the current folder called Reagents with fields ReagentRowId and ReagentName. Note that it's not yet possible to initialize a list with data from a file based module, though you can use SQL to create tables that are available for queries.

<select id="myDropDown"></select>
<script>
LABKEY.requiresClientAPI();
</script>
<script>
LABKEY.Query.selectRows({schemaName:"lists", queryName:"Reagents",
successCallback:populateDropDown});

function populateDropDown(data)
{
  for (var i = 0; i < data.rows.length; i++)
  {
    var row = data.rows[i];
    var opt = document.createElement("option");
    opt.value = row.ReagentRowId;
    opt.text = row.ReagentName;
    document.getElementById("myDropDown").options.add(opt);
  }
}
</script>

Note that the queried data is returned *asynchronously* and passed to the successCallback function. The populateDropDown function will be called sometime after selectRows is called (generally quickly, but you can't assume the drop-down is populated until you the successCallback function has been called).
 
dho responded:  2009-05-13 05:01
Thanks Mark and Elizabeth for your prompt responses!

dave