13.2 Dataset label versus name - Can't find ViewName

LabKey Support Forum (Inactive)
13.2 Dataset label versus name - Can't find ViewName Anthony Corbett  2013-10-15 15:07
Status: Closed
 
I'm doing some internal upgrade testing on 13.2 for our servers and I noticed that the labkey log file now produces warnings for doing a Query.selectRows API call where the queryName is the dataset label and not the dataset name:

WARN DataSetQueryView 2013-10-15 17:15:13,599 TP-Processor5 : Dataset in schema'study' was referenced by label (Protocol Deviation), not name (protocolDeviation).

When no viewName parameter has been specified, this seems to be just a warning and the QUERY API selectRows still returns the data as expected. However if you have a custom viewName specified you get an error:

Parameters:
query.queryName    'Protocol Deviation'
query.viewName    'Protocol Deviation Report'
schemaName    'study'

Error:
{
  "exceptionClass" : "org.labkey.api.view.NotFoundException",
  "exception" : "The view named 'Protocol Deviation Report' does not exist for this user!",
  "stackTrace" : [ "org.labkey.query.controllers.QueryController$SelectRowsAction.execute(QueryController.java:2190)", "org.labkey.query.controllers.QueryController$SelectRowsAction.execute(QueryController.java:2148)", "org.labkey.api.action.ApiAction.handlePost(ApiAction.java:161)", "org.labkey.api.action.ApiAction.handleGet(ApiAction.java:94)", "org.labkey.api.action.ApiAction.handleRequest(ApiAction.java:88)", "org.labkey.api.action.BaseViewAction.handleRequestInternal(BaseViewAction.java:177)", "org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)", "org.labkey.api.action.SpringActionController.handleRequest(SpringActionController.java:354)", "org.labkey.api.module.DefaultModule.dispatch(DefaultModule.java:989)", "org.labkey.api.view.ViewServlet.service(ViewServlet.java:165)", "javax.servlet.http.HttpServlet.service(HttpServlet.java:717)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)", "org.labkey.api.data.TransactionFilter.doFilter(TransactionFilter.java:36)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)", "org.labkey.core.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:118)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)", "org.labkey.api.module.ModuleLoader.doFilter(ModuleLoader.java:800)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)", "org.labkey.api.security.AuthFilter.doFilter(AuthFilter.java:171)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)", "org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)", "org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)", "org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)", "org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)", "org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)", "org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)", "org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)", "org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:311)", "org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776)", "org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)", "org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)", "org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)", "java.lang.Thread.run(Thread.java:724)" ]
}

If I change the queryName in the above Paramters from the dataset label 'Protocol Deviation' to the dataset name 'protocolDeviation' it works 13.2 but breaks on 13.1.

Seems like 13.1 does viewName resolution is based on dataset label and now in 13.2 veiwName resolution is based on dataset name.

So the change from dataset label to name is almost backwards compatible, except when using an explicit viewName. Since there is a warning message now for API calls based on dataset label is it Labkey's recommendation going from 13.2 forward to use dataset name for queryName parameter?

Also, the above error isn't logged in labkey.log file. It is returned to the browser, which is where I copied it from.
 
 
Anthony Corbett responded:  2013-10-15 15:36
Title: 13.2 Query API - Dataset label versus name - Can't find ViewName

I've uncovered another area affected by this: QueryWebPart. If you configure a QueryWebPart using dataset label as the queryName, as you would in 13.1, it doesn't find the custom viewName, but instead of erroring it shows the default view.

new LABKEY.QueryWebPart({
      renderTo: 'QWPgrid',
          containerPath: LABKEY.ActionURL.getContainer(),
          schemaName: "study",
          queryName: "Ancillary Illness Visit",
      viewName: "Ancillary Illness Visit Overview"
});

The queryName above is the dataset's label and it doesn't show the correct viewName but the default. If you change this to the dataset's name it will show the correct viewName.
 
cnathe responded:  2013-10-16 06:55
Anthony,
In 13.2 we did make some changes so that queries/views/reports are associated with a dataset name instead of label as we assume that the dataset label is more likely to change than the name would be. The intent is that we are still backwards compatible so that we are able to resolve the dataset queryName based on either the name or label. However, it looks like you found a case we didn't check for when trying to resolve the dataset view name using the label. I have open a 13.2 issue for this here:
https://www.labkey.org/issues/home/Developer/issues/details.view?issueId=18787

I have a local fix and should be able to get it checked in soon.
Thanks,
Cory
 
Anthony Corbett responded:  2013-10-16 07:01
Cory,

Thanks for looking into this.

Will a new 13.2 build be made available that includes this fix? We will hoping to get this along with our upgrade to 13.2.

Also, is it Labkey's recommendation going forward to use dataset name for queryName parameter?

Thanks,

Anthony
 
cnathe responded:  2013-10-17 07:39
Anthony,
The fix for this issue was checked in to the 13.2 release branch with r28949. We'll make sure to post a build somewhere that you can grab it shortly.

Regarding your question, LabKey has now changed things so that the dataset name is considered the query name for a dataset, when you look in the schema browser for example. Our recommendation would be to use the dataset name for the queryName parameter of those API calls going forward. We should however be backwards compatible in resolving the query name from the dataset label as well with this fix.

-Cory
 
cnathe responded:  2013-10-17 11:26