Create the Report JSON file

The Report JSON file is a JSON file that contains all information necessary for successful execution of the report and is used to update report data in the WorkZone database.

The WorkZone PDF Installer program uses the Report JSON file to install custom reports when the Configure Database target option is selected during the PDF installation. You can also manually update existing reports and add new ones to the WorkZone database, but it is not recommended.

After you have created the OData quereies, you must create a Report JSON file. As JSON files are normal text files, you can use any text-editor program to create and edit the Report JSON file.


The Report JSON file contents

The Report JSON file contains the following information

Parameter Type, Length Description Required

ReportId

String, 38

A unique identifier, i.e. a GUID.

Version

Number, 12

The version number of the report. The format is 8 to 10 ordinal numbers: for example, xxxxxxxxxx. The following algorithm is used for forming a version number: major+minor +build+revision (xx.xx.xxxxx.xx). If "minor" and "revision" parts contain 0, 0 may be omitted: 0x = x.

EntityType

String, 30

The entity type for which the report is intended, for example, Case, Record, Party, Task, Process.

 

Localizations

String, 255

The name, description, culture name, and file name (one or several localizations are allowed).

 

OdataQueries

String, 2000

The OData queries used by the Report JSON.

Parameters

String, 2000

JSON with parameters that will pass into the OData.

 

Caption

String, 255

In reports, the caption value can be used in the following context:

  • as a first-level bookmark (table of content item) in the PDF file
  • in the custom headers or footers
  • as a title of a converted PDF file that is saved on WorkZone Content Server

In Report JSON, you must specify a path to the caption value. See How to compose a JSON Path.

Example:  

Report JSON: { "Files": { "UserKey": "C-123" } }

A path in Report JSON: $.Files.UserKey

Caption value: C-123.

 

DefaultOutput

String, 12

The file type of the report requested by WorkZone Client. Use the file extension in the upper-case format, for example, PDF, XLSX, DOCX, PBIX, etc.

AccessCode

 

The read rights on report (see WorkZone Client permissions documentation).

 

UpdateCode

 

Specifies Update rights on report (see WorkZone Client permissions documentation).

 

System

 

Specifies type of the report:

True – standard (deployed as a part of installation);

False – customized for the customer's needs.

 

Default

 

Defines which report of the same EntityType WorkZone Client will use as the default one.

 


The OData query section in the Report JSON file

The OData query section of the Report JSON file must contain the following:

  • A root (or main) element
  • A tree structure of elements, from the root entity to deeper related entities that correspond to parts of the resource path in the OData URL.
  • A #Query property under each node with a value that either corresponds to the query options in OData URL (starts from “?”) or contains the empty value “” if there are no query options for current resource.

If you want to retrieve an array of objects, you must encompass the objects in question with square brackets ( [ ] ).

Parameters passed to the Report JSON must be prefixed with @.

Example: OData section of the Report JSON file

{
   "Records": [
   {
	"#Query":"('@RecordKeys')?$select=File/FileNo,
	File/Title,RecordNo,RecordKey,Title,RecordType_Summary&$expand=File",
 
	"SupplementaryDocuments": [
	{
	"#Query": "?$select=RecordKey,Title"
	}
      ]
    }
   ]
  }

The copy image is missing

Additional examples of OData queries can be seen in the Standard Reports in the Reports table (OData_queries column)

 

  • Do not include the same fields for the same entities in different places in the OData section.
    For example, if you specify a field under a branch, make sure that the same field does not appear for parent elements when using the expandcommand.
  • Check the syntax of the JSON file prior to executing the file. You can use various internet sources for the syntax check, for example, http://jsoneditoronline.org/.


Report JSON example

The following is an example of a Report JSON file. There are two custom report Word templates:

  • DocListSuppDocs_En.docx (English version)
  • DocListSuppDocs_Da.docx (Danish version)

Note the “Parameters” section

Remember to use hard brackets ( [] ) for multiple values. If you expect to only pass single values, use normal brackets ( {} ), according to standard JSON rules.

The following report JSON examples are taken from the report JSON files included in the WorkZone suite installation and are therefore available to all users and not customized for any specific customer.