Monday, July 27, 2009

XML - XML File Source

1. Generate your xml file using PeopleCode and then use the following:
method DisplayReport
   
   Local PSXP_RPTDEFNMANAGER:ReportDefn &C1_appReport;
   
   rem Create the ReportDefn class;
   &C1_appReport = create PSXP_RPTDEFNMANAGER:ReportDefn(&C1_strRptDefnID);
   
   rem Close the file;
   &C1_appXmlFile.CloseFile();
   
   try
      
      rem Get the report definition and set the xml file for the run time and then display the report;
      &C1_appReport.Get();
      
      &C1_appReport.SetRuntimeDataXMLFile(&C1_appXmlFile.C1_strDirAndName);
      &C1_appReport.ProcessReport(&C1_strTmpltID, "", %Date, "");
      
      CommitWork();
      &C1_appReport.DisplayOutput();
      &C1_appXmlFile.DeleteFile();
      
   catch Exception &Err
      Local string &sSub1, &sSub2, &sSub3, &sSub4, &sSub5;
      Evaluate &Err.SubstitutionCount
      When > 4
         &sSub5 = &Err.GetSubstitution(5);
      When > 3
         &sSub4 = &Err.GetSubstitution(4);
      When > 2
         &sSub3 = &Err.GetSubstitution(3);
      When > 1
         &sSub2 = &Err.GetSubstitution(2);
      When > 0
         &sSub1 = &Err.GetSubstitution(1);
      End-Evaluate;
      Error MsgGet(&Err.MessageSetNumber, &Err.MessageNumber, &Err.ToString(), &sSub1, &sSub2, &sSub3, &sSub4, &sSub5);
      
   end-try;
   
end-method;

No comments:

Post a Comment