Data Cut Date / refreshDate question

LabKey Support Forum (Inactive)
Data Cut Date / refreshDate question dennisw  2012-04-11 07:59
Status: Closed
 
The UI popup for adding/changing the Data Cut Date (AKA refreshDate) for a dataset in the Data Views webpart works great, but we need to do a bulk change on several groups of datasets. Where is the refreshDate stored? Is it in one of the LK tables in the DB? I know we have to shut down the LK server to manually change data in the DB, but this is a one time change we need to do so that would be fine.
 
 
Karl Lum responded:  2012-04-12 14:06
The refreshDate (and other metadata shown in data views) is stored in what we refer to as an ontology property and is not easily accessible using handwritten SQL. Perhaps a better option is to use the client API that the data views panel uses to edit these properties, it would require a little bit of javascript code to first query the datasets you wanted to update the cut date for, and then using the entityId for each dataset as a key, use the editView API to update the date. Here is a sample piece of code (with the entityId hardcoded):


                        Ext.Ajax.request({
                            url : LABKEY.ActionURL.buildURL('study', 'editView.api'),
                            method : 'POST',
                            params : {
                                refreshDate : '2012-04-16',
                                entityId : '6dd43fa6-43dd-102f-9120-7270029090a0',
                                dataType : 'datasets'
                            },
                            success : function(){
                            },
                            failure : function(response){
                                Ext.Msg.alert('Failure', Ext.decode(response.responseText).exception);
                            },
                            scope : this
                        });

To query for the dataset information, use the LABKEY.SelectRows API on the study.datasets table:


                        LABKEY.Query.selectRows({
                            schemaName : 'study',
                            queryName : 'Datasets',
                            columns : ['Label', 'EntityId'],
                            success : function(data, response, options){
                                
                            }
                        });
 
dennisw responded:  2012-04-13 11:18
Thanks. That looks like a workable solution.