Rendering Output

CPAS Forum (Inactive)
Rendering Output rthomas  2006-03-24 15:00
Status: Closed
 
Hi there,

I'm writing a module that executes ad-hoc queries on various data sources.

The queries execute and ResultSets arereturned along with all the metadata (I can see this from within the debugger), but I'm not sure how to render the output using the CPAS API's.

Attempting to set up a GridView/DataRegion/renderInTemplate results in the error (see below) about how no table has been set up. So I'm obviously misusing these classes and should probably use something else. I've got my own class for setting up the DataRegion (output columns and such) but I'm just stuck on getting it displayed.

Thanks - Bob

Here are the final error message lines.

500: Unexpected server error
No query table in DataRegion.renderTable

[Show more details]

java.sql.SQLException: No query table in DataRegion.renderTable
       at org.fhcrc.cpas.data.DataRegion.checkResultSet(DataRegion.java:589)
       at org.fhcrc.cpas.data.DataRegion._renderTable(DataRegion.java:545)
       at org.fhcrc.cpas.data.DataRegion.render(DataRegion.java:1173)
       at org.fhcrc.cpas.data.DataRegion.renderTable(DataRegion.java:534)
       at org.fhcrc.cpas.view.GridView._renderDataRegion(GridView.java:56)
       at org.fhcrc.cpas.view.DataView.renderView(DataView.java:112)
       at org.fhcrc.cpas.view.DataView.renderView(DataView.java:30)
       at org.fhcrc.cpas.view.HttpView.renderView(HttpView.java:127)
       at org.fhcrc.cpas.view.HttpView.render(HttpView.java:106)
       at org.fhcrc.cpas.view.WebPartView.render(WebPartView.java:128)
       at org.fhcrc.cpas.view.HttpView._render(HttpView.java:267)
       at org.fhcrc.cpas.view.HttpView.include(HttpView.java:465)
       at org.fhcrc.cpas.jsp.compiled.org.fhcrc.cpas.view.HomeTemplate_jsp._jspService(HomeTemplate_jsp.java:110)
       at org.fhcrc.cpas.view.JspView.renderView(JspView.java:61)
       at org.fhcrc.cpas.view.HttpView.render(HttpView.java:106)
       at org.fhcrc.cpas.view.WebPartView.render(WebPartView.java:128)
       at org.fhcrc.cpas.view.HttpView._render(HttpView.java:267)
       at org.fhcrc.cpas.view.HttpView.include(HttpView.java:442)
       at org.fhcrc.cpas.view.ViewController.includeView(ViewController.java:48)
       at DfMirror.DfMirrorController._renderInTemplate(DfMirrorController.java:131)
       at DfMirror.DfMirrorController.handleAdHocQuery(DfMirrorController.java:59)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 
 
arauch responded:  2006-03-24 17:12
Did you set the display columns you want to see using DataRegion.setColumns()?

If you want the DataRegion to create the query and get the ResultSet (the usual case) it needs to know what table to query. You can call DataRegion.setTable() to do this, but we usually don't bother… if not set, the DataRegion will iterate the display columns and use the table associated with the first database-bound column. If you 1) haven't set the result set directly and 2) didn't call either setColumns() or setTable() you will get the error above.

 
adam responded:  2007-01-03 14:41