Author Topic: Generating a report with RunReport doesn't include the element section  (Read 2524 times)

skranenburg

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Hi,

I've been attempting to write a small script (that will be added to another one later) that generates a report using RunReport. After several attempts, I finally got past the errors that would appear as the report generation window pops up, but the report I get does not include the elements and their requirements (the main reason for the report). Going the normal route in generating a report with the same template does, however. This is my script. I have edited the GUID and the file path for this post.

var prj = Repository.GetProjectInterface();
var pkge as EA.Package;

function main()
{
   pkge = Repository.GetPackageByGUID("{GUID}");
   pkge.Update();
   prj.RunReport(pkge.PackageGUID, "Requirement Test", "C:\\Users\\...\\Report Generation\\3.docx");
}

main();

I'm not sure if the is a problem is with this little block of script, but if anyone could give me some insight, I would greatly appreciate it!

Thank you!
Stefan

skranenburg

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Generating a report with RunReport doesn't include the element section
« Reply #1 on: January 14, 2021, 04:38:18 am »
Also, if there is a way to write the file path so that it doesn't have to specific to one's computer, I would appreciate advice on how to do so.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Generating a report with RunReport doesn't include the element section
« Reply #2 on: January 14, 2021, 05:31:41 am »
Most operations in the Project interface expect the GUID's in xml format rather than the normal format. (although the documentation doesn't mention that for this particular one)

You can convert a GUID using GUIDtoXML()

With regards to the filepath. If you don't want to hardcode it, you can ask the user to select a file using Repository.InvokeFileDialog (or some other method file selecting a filename)

Geert

skranenburg

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Generating a report with RunReport doesn't include the element section
« Reply #3 on: January 14, 2021, 07:20:19 am »
Hi Geert!

Thanks for the help! The InvokeFileDialog is definitely something I needed.

Seems like the RunReport method is liking the normal version of the GUID more than the XML version. I got the same errors at the report generation window. My issue is that the report that it outputs is not including any part of the template that includes the individual elements of the package. The diagrams in the package are included, though. I'm confused because going the manual route to output a report includes everything that I want.

Best,
Stefan