Creating an 'Import Data' button for external schema hard tables?

LabKey Support Forum (Inactive)
Creating an 'Import Data' button for external schema hard tables? Ben Bimber  2010-11-23 07:31
Status: Closed
 
if the table in an external schema has a PK, labkey is able to insert/delete from it. When viewed in executeQuery, this table has buttons to do these actions. However, it doesnt have an 'import data' action (aka spreadsheet import). I'm going to need to enable that on some tables and would hope to do that in a pretty generic way.

Does anyone has suggests on the best approach? Can I add some button that redirects to an existing labkey page? If I create the HTML UI to capture the file and/or spreadsheet text blob, can I post that to some existing API where it would get processed? Is there a different approach I should use?

It would be nice if the same approach could be adapted so I could add import data to multiple kinds of tables, including regular lists. lists don't have an import data button when embedded using a QWP, at least as far as i know.

thanks for the help.
 
 
jeckels responded:  2010-11-23 10:15
Hi Ben,

It's a shame that we don't have a built-in Import Data button that works for all tables that support QueryUpdateService (and therefore LABKEY.Query.insertRows, LABKEY.Query.deleteRows, etc), but it's not too hard to do this with a bit of custom UI. Here's an implementation I put together a while ago that lets a user upload a file (TSV or Excel), grabs its contents from the server, and inserts them into a table through the standard LABKEY.Query.insertRows().

I'll try to get something like this added to the core server in 11.1.

Thanks,
Josh
 
Ben Bimber responded:  2010-11-23 10:19
hi josh,

that's very similar to what i've done in assay uploads. so i assume there's nothing that avoids that intermediate client-side step of parsing the JSON, then running InsertRows()?
 
jeckels responded:  2010-11-23 10:21
Hi Ben,

Correct. We have that wired up for specific data types like lists and datasets, but not for external schemas. One of our infrastructure projects for 11.1 is working on standardizing our implementations across data types.

Thanks,
Josh