INSERT INTO using the webinterface

LabKey Support Forum (Inactive)
INSERT INTO using the webinterface jeckels  2013-05-30 17:04
Status: Closed
 
Hi Volker,

I'd recommend using a trigger script on your demographics dataset to hook this up:

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

In your beforeInsert() function, you can use LABKEY.Query.insertRows() to insert blank rows into all of the other datasets:

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

You can use LABKEY.Query.selectRows() to ask the "dataset" query in the "study" schema what datasets are available if you don't want to have the set hard-coded in your trigger script. Note that for non-demographic datasets, you'll need to include the PID as well as a date/visit number. Non-demographic datasets always require a date or visit number (which one depends on the type of study you've created) as part of every row.

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

Thanks,
Josh