← Reports Academy

Build the solution · 5 / 5

Finish the production handover pack

Deliver CSV, workbook and a printable summary from one report.

YOUR TASK

Make this happen

3 steps
  1. Add a PDF output using handover.pdf.xml. Include a showNote condition and job rows bound to datasets.jobs with job.name and job.status text. Keep CSV and workbook outputs.

  2. Keep the working capabilities from the previous lesson and connect the new pieces to the same solution.

  3. Check the complete solution, then inspect any unmet requirements.

This step starts with the earlier solution and one new challenge. Each lesson keeps its own draft.

Read the starter files

main.cococo

report_document "weekly" {
  schemaVersion = 1
  snapshotRetentionDays = 30
  sources = [report_source.jobs]
  outputs = [report_output.csv, report_output.workbook]
  parameters = [report_parameter.show_note]
  preparationScript = file("prepare.lua")
}

source.cococo

report_source "jobs" {
  name = "jobs"
  kind = "MICRO_SQL"
  query = "SELECT jobs.name, jobs.status FROM jobs ORDER BY jobs.name ASC LIMIT 100"
}

outputs.cococo

report_output "csv" {
  name = "jobs.csv"
  format = "CSV"
  storage = "DATABASE"
  dataset = "jobs"
  columns = ["name", "status"]
}
report_output "workbook" {
  name = "handover.xlsx"
  format = "XLSX"
  storage = "DATABASE"
  sheets = [report_sheet.jobs, report_sheet.summary]
}

parameters.cococo

report_parameter "show_note" {
  name = "showNote"
  label = "Include handover note"
  type = "BOOLEAN"
  required = false
  defaultValue = false
}

prepare.lua

input.datasets.summary = {{ message = "Production handover" }}
return input

sheets.cococo

report_sheet "jobs" {
  name = "Jobs"
  dataset = "jobs"
  columns = ["name", "status"]
}
report_sheet "summary" {
  name = "Handover"
  dataset = "summary"
  columns = ["message"]
}

handover.pdf.xml

<pdf size="A4" margin="40" xmlns:t="urn:cococo:template">
  <text size="22">Production handover</text>
  <!-- TODO: add the conditional handover note and repeating job rows. -->
  <table>
  </table>
</pdf>

Reference: reports · getting-startedreports · sql-authoringreports · valuesreports · preparationreports · pdf-templatesreports · operationsreports · reference