Advanced Reporting Engine: Json Export

Generate a JSON file, or prepare a report for a programmatic API call.

Zack Schwartz avatar
Written by Zack Schwartz
Updated over a week ago

The following article is for advanced usage and is only applicable for one of two scenarios:

A prerequisite for this article assumes that you know how to create a basic report in OpenWater.

To get started with a JSON export, first navigate to your report and click on Advanced and then check the box for Enable Json Export. Then click Manage.

The JSON that is rendered as output for the report is actually completely defined by you via a python script. The boilerplate below can be used as the most basic Python report.

#HEADER#
data = []
#END HEADER#

#BODY#
temp = {}
temp["Id"] = {ApplicationCode}
temp["Email"] = {Email}
temp["Category"] = {ApplicationCategoryName}
temp["Title"] = {ApplicationName}
temp["Date"] = {SubmittedAt}
temp["WinnerInfo"] = {ApplicationWinningTypes}
data.append(temp)
#END BODY#

#FOOTER#
___result = data
#END FOOTER# 


The #HEADER# section is a good place to define variables that will be stored once. The #BODY# section is rendered once for every submission included in the report. This is where you would want to make use of the variables. And finally #FOOTER# is also rendered once.

You can also click Insert Boilerplate to get a starter script that will pull in all fields from the submission form for you.

The python dictionary that you build will be converted to JSON.

Click Save and Run Test which will choose up to 10 submissions to render and output the JSON file. If there are any syntax errors, it will tell you. You can also click Save and Export Script which will generate the resulting Python script for you to analyze for any other debugging purposes.

Run the Report

To run the report in full, return to the General and tab and refresh your page to see JSON as an option now.

Send to External System for Further Processing

This feature is currently undocumented and only used by OpenWater developers.

Did this answer your question?