Scenario:
I have a report that displays the Function Group Name for a certain individual and all the Functions included in that Function Group. The following are the tables involved:
USER, FUNC_GROUP (contains description of the group) and FUNC_GROUP_LIST (the actual functions in the FUNC_GROUP).
The SQL command for the main report is: select id, name, description from FUNC_GROUP, USER where FUNC_GROUP.id = USER.default_func_group_id
The sub-report which lists the functions for the Function Group has the following SQL command: select id, name from FUNC where func_group_id = <main report's FUNC_GROUP.id>
The problem is my current code still flags missingParameterValueError error whenever I changed the DB location and set the parameters.
Code used for setting of db connection:
private void setDBConnection(ReportClientDocument doc) throws ReportSDKException { IConnectionInfo newConnectionInfo = new ConnectionInfo(); newConnectionInfo.setAttributes(new PropertyBag(connectionProperty)); newConnectionInfo.setUserName(getLoginname()); newConnectionInfo.setPassword(getPassword()); //preserve subreport links SubreportController src = doc.getSubreportController(); Map<String, SubreportLinks> linkMapper = new HashMap<String,SubreportLinks>(); for(String subreportName : src.getSubreportNames()){ linkMapper.put(subreportName, (SubreportLinks) src.getSubreportLinks(subreportName).clone(true)); } //If this connection needed parameters, we would use this field. Fields<IParameterField> pFields = doc.getDataDefController().getDataDefinition().getParameterFields(); replaceConnectionInfos(doc.getDatabaseController(), newConnectionInfo, pFields); IStrings strs = src.getSubreportNames(); Iterator<String> it = strs.iterator(); while (it.hasNext()) { String name = it.next(); ISubreportClientDocument subreport = src.getSubreport(name); pFields = subreport.getDataDefController().getDataDefinition().getParameterFields(); replaceConnectionInfos(subreport.getDatabaseController(), newConnectionInfo, pFields); } //reconnect subreport links since when using replaceConnection links are erased for(String subreportName : src.getSubreportNames()) src.setSubreportLinks(subreportName, linkMapper.get(subreportName)); }
Edited by: Rizza Lynn Ponce on Jun 2, 2009 11:56 AM