Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Data input solution after changing data source dyn

Author  Topic 

wayne.zjw
Starting Member

10 Posts

Posted - 2009-12-19 : 13:57:06
Problem

Sometimes, users may change the data source of input report template through RAQ Report API dynamically. However, after releasing the input report template with tag, an error message “Can’t find data source!” usually appears when users are inputting data in the web page.

Analysis

Through API of RAQ Report, users can only change the name of the data source of report template dynamically, but not change the data source in updated attribute correspondingly. As a result, the data sources in input template and updated attribute are different. Then, when users are inputting data, the system can’t find correct data source, and an error message pops up.

Solution

After changing the data source of report template, users should change the data source of updated attribute correspondingly.

With RAQ Report, users only need to get the corresponding relations between input report attribute and updated attribute, and change the data source of updated attribute.

Example

ReportDefine rd = (ReportDefine)ReportUtils.read(raq);
INormalCell cell = rd.getCell(2, (short)1);
//Get input report attributes.
InputProperty ip = cell.getInputProperty();
ArrayList al = ip.getUpdateList();
UpdateProperty up = (UpdateProperty)al.get(0);
//Get corresponding relations between input report attribute and updated attribute.
Object relations = up.getRelation();
if(relations instanceof com.runqian.report4.usermodel.input.TableRelations){
TableRelations trs = (TableRelations)relations;
System.out.println(trs.getDataSourceName());
//Set the data source of updated attribute.
trs.setDataSourceName("northwind");
up.setRelation(trs);
ArrayList ups = new ArrayList(1);
ups.add(up);
ip.setUpdateList(ups);
cell.setInputProperty(ip);

RAQ Report - the best free java reporting tool ever
   

- Advertisement -