← Reports Academy

Build the solution · 3 / 5

Prepare a handover note

Add a summary dataset without calling a live service.

YOUR TASK

Make this happen

3 steps
  1. Add prepare.lua to create input.datasets.summary = {{ message = "Production handover" }} and return input. Connect it with preparationScript = file("prepare.lua").

  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]
  parameters = [report_parameter.show_note]
}

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"]
}

parameters.cococo

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

prepare.lua

-- input contains the report datasets.
-- TODO: add the summary dataset before returning the report input.
return input

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