If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

SDK - How to validate report/specification

Started by teresapy, 30 Sep 2021 01:02:48 PM

Previous topic - Next topic

teresapy

Hi,
  We are working on a project that automates the import and validation reports in C11.
For some reason, the validation errors are different or missing from the ones we see in MotioPI.
Does anyone know what we are missing?

here is the code we use:

protected Option[] getExecuteValidateOptions() {
      ArrayList<Option> runOptionList = new ArrayList<>();

      ValidateOptionValidateSeverity severity = new ValidateOptionValidateSeverity();
      severity.setName(ValidateOptionEnum.severity);
      // severity.setValue(ValidateSeverityEnum.warning);
      severity.setValue(ValidateSeverityEnum.error);
      runOptionList.add(severity);

      /** Set the option to always have the primaryRequest in the response */
      AsynchOptionBoolean includePrimaryRequest = new AsynchOptionBoolean();
      includePrimaryRequest.setName(AsynchOptionEnum.alwaysIncludePrimaryRequest);
      includePrimaryRequest.setValue(true);

      AsynchOptionInt primaryWait = new AsynchOptionInt();
      primaryWait.setName(AsynchOptionEnum.primaryWaitThreshold);
      primaryWait.setValue(0);
      runOptionList.add(primaryWait);

      AsynchOptionInt secondaryWait = new AsynchOptionInt();
      secondaryWait.setName(AsynchOptionEnum.secondaryWaitThreshold);
      secondaryWait.setValue(0);
      runOptionList.add(secondaryWait);

      return (Option[]) runOptionList.toArray(new Option[runOptionList.size()]);
   }

Option[] runOptions = getExecuteValidateOptions();
AsynchReply rsr = null;
ReportServiceReportSpecification rsSpec = new ReportServiceReportSpecification(new Specification(reportSpec));
rsr = reportService.validateSpecification(rsSpec, reportParameters, runOptions);

// If response is not immediately complete, call wait until complete
if (!rsr.getStatus().equals(AsynchReplyStatusEnum.complete)
   && !rsr.getStatus().equals(AsynchReplyStatusEnum.conversationComplete)) {

   while (!rsr.getStatus().equals(AsynchReplyStatusEnum.complete)
      && !rsr.getStatus().equals(AsynchReplyStatusEnum.conversationComplete)) {

   // before calling wait, double check that it is okay
   if (CognosHelper.hasSecondaryRequest(rsr, "wait")) {
      rsr = reportService.wait(rsr.getPrimaryRequest(), new ParameterValue[] {}, new Option[] {});
   } else {
      throw new RemoteException("Error: Wait method not available as expected. Unable to return report in this format");
   }

    }
}

for (int i = 0; i < rsr.getDetails().length; ++i) {
    if (rsr.getDetails() instanceof AsynchDetailReportValidation) {
      XmlEncodedXML defects = ((AsynchDetailReportValidation) rsr.getDetails()).getDefects();
      log("      ** ERROR(Validation) **: " + defects.get_value());
    }
}

Thanks!