Comparing Versions (Diff Viewer)

To better address the challenges of parallel development in FNZ Studio Composition, FNZ Studio provides the Business Object Diff Viewer feature. This tool allows you to easily compare two versions of any Business Object and view the differences between them.

Accessing the Tool

Business Object Diff Viewer is an effective tool for comparing two versions of a Business Object. It can be accessed in a variety of ways:

  • Right-click any Business Object in the Library that has more than one version, and select Compare Versions. The diff viewer opens in a new browser tab. By default, the tool compares the Head version of the selected Business Object with the previous version. If the business object has only one version, the Compare Versions option is disabled.
  • Right-click any Business Object and select Show Versions. If the Business Object has more than one version, you get the option to access the diff viewer.
  • When importing a package that contains a business object with the same ID as an already existing one. In such case, you can open the Business Object Diff Viewer in another window, compare the two versions, and decide whether you want to import and overwrite the Business Object or keep the current one.
  • When working on a Business Object in the Business Object Editor, click the hamburger icon and select Compare Versions.

Comparing the Properties

The Business Object Diff Viewer's user interface presents the changes in a clear and intuitive way, with the attributes of one version displayed on the left, and the attributes of the other on the right side of the screen. Depending on the type of the analyzed Business Object, its properties are displayed in groups. For example, for a Data Class Business Object, the groups are Business Object Properties and Content:

properties_1.jpg

However, properties of a Script Function Business Object are grouped into Business Object Properties, Documentation, Signature, and Body:

properties_2.jpg

The differences in grouping of properties are related to the different nature of Business Objects in FNZ Studio. Business Object Properties is a group common to all Business Objects, as it contains the main attributes used to identify them – ID, Name, and Description.
The vertical bar that separates the two compared versions is also a place where you can find a couple of useful options. At the very top of the bar, you can click the Next and Previous arrows to highlight the next or previous detected change. The highlight disappears after two seconds. The number between the two arrows is a counter of how many differences were detected between the two Business Objects.

arrows.jpg

An arrow icon on the vertical bar next to a property means that it can be expanded to display its underlying elements:

expand.jpg

Click the hamburger icon in the top left of the screen to quickly Collapse All or Expand All elements that show up as expandable.
Some of the properties, such as variables, may offer an option to show their details. In such cases, the vertical bar features an icon which you can click to view the details of this specific property:

details.jpg

Text Diff Viewer

The Text Diff Viewer tool is an integral component of the Business Object Diff Viewer, and can only be accessed directly from it. To access the Text Diff Viewer, double-click any text-based property in the Business Object Diff Viewer. Alternatively, right-click a text-based property and select Compare Property in Text Diff Viewer. The tool opens in a new window.
Text Diff Viewer can analyze any text-based property for differences but it is especially useful when comparing two versions of a script function and looking for changes in the body of this function. The tool highlights the syntax of the following types of text:

  • mimeType: 'application/vnd+appway.script+txt', language: 'appway'
  • mimeType: 'appway', language: 'appway'
  • mimeType: 'application/javascript', language: 'javascript'
  • mimeType: 'application/xml', language: 'xml'
  • mimeType: 'text/css', language: 'css'

Use the arrows in the top-middle part of the screen to quickly jump to the next detected difference within the text.
Text Diff Viewer uses colors to indicate the blocks of text that have been either changed, added, or moved:

  • Yellow background indicates that the block of text has been added or changed
  • Orange background indicates that the block of text exists in the other version in an unchanged form but has been moved

The tool also uses stronger yellow highlight to indicate a changed portion of text within the same line.

Note: The Text Diff Viewer ignores empty lines, so it ignores any changes related to added or removed empty lines.

Scrolling in Text Diff Viewer is always performed in sync for both versions of the document. On the left side of the screen, you can find a "mini map" that helps you to navigate longer documents and also highlights the parts of text where changes were detected. If one version of the document does not contain a line that occurs in the other document, this missing line is replaced by a dotted pattern. In this way, the subsequent lines are displayed consistently on both sides of the screen.

text_diff.jpg

All changes are marked from the perspective of the right side of the screen. In other words, Text Diff Viewer shows what is different in the version on the left, compared to the version on the right. Under the hamburger icon, you can find a Swap Panes option that changes this perspective. All changes are then marked on the right side.

Merging Changes

Merging different versions of Business Objects into one consolidated Business Object is a separate feature based on the Diff Viewer. See Merging Business Objects for more details.