Comparing two version of a ForNAV report

The ForNAV cmdlet (https://www.fornav.com/knowledge-base/powershell-cmdlet/) has been extended to support Diff and Patch of the ForNAV report layout

To support this, the cmdlet has been extended with three new parameters:

  • Diff – Path to the destination for the diff json file.
  • Patch – Path to a json file containing the diffs that will be applied to the reports.
  • Baseline – Path to a  .txt file containing the original ForNAV reports to form a basis for the diff.

If the Baseline parameter is not specified, the Diff json file will contain all data items, sections, and controls, including their properties. This can be used to make batch editing of names and captions using a text editor and, if the cmdlet is run with the Patch parameter, the changes will be applied to the ForNAV report layout.

In this example, the “CurrReport_Caption” control has been modified from font size 8 to 10:

            “Bands”: {
              “DocumentHeader”: {
                “Controls”: {
                  “CurrReport_Caption”: {
                    “@Font”: [
                      “Segoe UI, 8pt, style=Bold”,
                      “Segoe UI, 10pt, style=Bold”
                    ]
                  }
                }
              },
 

And the same control is represented like this if no Baseline has been specified:

                    “CurrReport_Caption”: {
                      “@ControlType”: “ForNavTextBox”,
                      “@Name”: “CurrReport_Caption”,
                      “@Size”: “1000,60”,
                      “@Pos”: “0,500”,
                      “@Font”: “Segoe UI, 8pt, style=Bold”,
                      “@ForeColor”: “Black”,
                      “@HorzAlign”: “Left”,
                      “@SourceExpr”: “CurrReport.Caption + ‘: ‘ + Header.No”
                    },
 

The name of a control or section is controlled by the @Name property.

Warning: If you instead change the name of the json class (in this example, “CurrReport_Caption”), a new control will be inserted when the json is used for a patch and, if @Name is not specified, the control will be nameless.

Currently there is no validation of the ForNAV report layout after a patch has been issued, which might lead to an unexpected runtime error. In order to validate the report, you must open the report in the Designer and save it back again.

You can find information about the format here: https://github.com/benjamine/jsondiffpatch/blob/master/docs/deltas.md

Diff and Patch is supported in build 3.1.0.1475 and later.