Skip to content

LokqlDx tutorial ‐ report generation

NeilMacMullen edited this page Feb 20, 2025 · 2 revisions

If you haven't already completed the quick start tutorial you should try that first.

Loading the example workspace

If you downloaded the prebuilt-binaries, you will find a "tutorials" folder within the zip file, otherwise you can download the material from the tutorials section of the repository.

Note you'll need to download the following files to the same folder:

  • report_generation.lokqldx (the workspace)
  • traffic.csv (the dataset)
  • report_template.pptx (the powerpoint template)

Open the lokqlDx application and use the "File->Open Workspace" menu to load the report_generation workspace.

After loading the application, you should see something like this... image

Move the cursor into the query-editor window and use CTRL-A to select all text. Then use SHIFT-ENTER to execute all selected text.

You should see some activity in the chart window and the final message in the console window should indicate that a new powerpoint file has been created in the same folder as the input files...

image

If you open the generated file testreport.pptx in powerpoint you should see something similar to the following:

image

What's going on here?

The relevant section of the workspace is at the end... image

The startreport command is being used to load a template powerpoint file which contains elements which have been named to match the results generated in the first part of the workspace.

addtoreport is used to add a named result (saved using the push command) to the powerpoint. By default, addtoreport will assume the element and the result you want to store to it have the same name.

Finally finishreport is used to write out the new powerpoint into a different file.

Other points

In this example we've used the set command to change the variable vega.theme during the powerpoint generation. That controls the styling of the charts. It may seem odd to do this during the report generation rather than during the query phase but saved results only contain basic visualisation instructions; they are not fully rendered until required.

Further information

See this page for fuller instructions on generating reports.