2009年5月30日星期六

Data input solution after changing data source dynamically in RAQ Report

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);

Source: Knowledge Base of Java Reporting Tool
Original Post: Data input solution after changing data source dynamically in RAQ Report
Related Articles:
Submit data to multi-dataset/multi-source with web-based reporting tool — RAQ Report;
Make drop-down calendar for web application with web reporting tool;
Design web report with graphical interface of reporting tool;
Wonderful solution for complex data input in web report ;
Useful Links:
Knowledge Base of Web Reporting Tool;
Reporting Insights from Raqman;
Live in Reporting;
Dynamic datasource selection for BIRT and e.Spreadsheets;

Tag after API, data input, data source, dynamic data source, input report, input report template, java, RAQ Report, web input, web reporting

clip_image001RAQSOFT: Innovative Techology Makes Progress.


For more about reporting tool, you are welcome to refer to freezea's blog.

没有评论:

发表评论