Follow

How do I set up Business Unit Reports?

The following article will set you up with a sample Business Unit report which you can use as a starting point for writing your own Business Unit report plugins.

  1. Download the attached sample_report.zip
  2. Unzip sample_report.zip
  3. You should see a directory sample_report with two files-- sample_report.py, sample_report.html.
  4. Place the "sample_report" directory into /docs/sde/plugins/business_unit_reports/ and ensure that the directory and files are owned by sde_admin and the group sde, and that the permissions on the files are 644 or 640.
  5. Restart SDE by running touch /docs/sde/live/code/sigma/deployment/*wsgi
  6. You should be able to see the BU reports tab under the BU page.

This sample report outputs all the projects within the selected BU, the members and member groups belonging to the project, and the datetime the project was last updated. It demonstrates how to create a report with html, csv, and pdf download formats.

 

CSV Output Key Points

  1. 'header' variable in the context-- this needs to be a list of strings representing the title of each column in the csv.
  2. 'csv_data' variable in the context-- this needs to be a list of tuples. Each tuple contains strings and represent a row of the csv (excluding the header).
  3. 'filename' attribute on the class level of the report class. This sets the output csv filename-- you do not need to append this with .csv since the pdf outputter uses the same variable and will use the correct suffix.

 

HTML Output Key Points

  1. 'template' variable on the class level of the report class. This allows the html to use the template (sample_report.html) to render the report. You can customize the template using Django Template Language.

 

PDF Output Key Points

  1. 'filename' attribute on the class level of the report class. This sets the output pdf filename-- you do not need to append this with .pdf since the csv outputter uses the same variable and will use the correct suffix.
  2. 'template' variable on the class level of the report class. This allows the html to use the template (sample_report.html) to render the report. You can customize the template using Django Template Language.

 

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments