SAP Knowledge Base Article - Public

1326488 - Crystal Reports Java SDK - How to Fix Broken Subreport Links When Changing Command Table or Stored Procedure Connection Infos.

Symptom

  • Crystal Reports for Eclipse 2.0 - Crystal Reports Java 12 SDK application.
  • Reports reporting off of parameterized Stored Procedure or Command Table, where parameters used in Subreport Linking.
  • Command Table or Stored Procedure Connection Information being changed programmatically at runtime.
  • Changing Connection information deletes the Subreport Links, resulting in "missingParameterValues" exception.

Resolution

  • To restore the Subreport Links, save the links before data source Connection Information is changed, then restore them after the change.
  • To save the subreport links:

    Map<String, SubreportLinks> linkMapper = new HashMap<String, SubreportLinks>();
    for(String subreportName : reportClientDocument.getSubreportController().getSubreportNames()) {
        linkMapper.put(subreportName, (SubreportLinks) reportClientDocument.getSubreportController().getSubreportLinks(subreportName).clone(true));
    }

  • To restore the subreport links:

    for(String subreportName : reportClientDocument.getSubreportController().getSubreportNames()) {
        reportClientDocument.getSubreportController().setSubreportLinks(subreportName, linkMapper.get(subreportName));
    }

Keywords

KBA , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , How To

Product

Crystal Reports, version for Eclipse 2.0