Share via


Compare-NAVApplicationObject

Compares text files with Business Central application objects and then calculates the delta between the two versions. The result of the comparison is a number of text files with the calculated delta. The deltas can later be applied to a third version by using the Update-NAVApplicationObject cmdlet.

Syntax

Default (Default)

Compare-NAVApplicationObject
    [-OriginalPath] <String[]>
    [-ModifiedPath] <String[]>
    [-DeltaPath] <String>
    [-PassThru]
    [-Legacy]
    [-NoCodeCompression]
    [-IgnoreDocumentation]
    [-Force]
    [-ExportToNewSyntax]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Use the Compare-NAVApplicationObject cmdlet to calculate the delta between one version of Business Central application objects and another version. The deltas can later be applied to a third version by using the Update-NAVApplicationObject cmdlet.

The Compare-NAVApplicationObject cmdlet compares the text files in the two specified folders and creates .delta files that describe the difference between the two versions. The text files must contain Business Central application objects that have been exported from the Business Central Development Environment. You can compare two text files that contain multiple application objects, and you can compare text files in two folders where each text file can contain one or more application objects.

The cmdlet creates a text file for each application object that is different between the two versions. For example, you compare two versions of table 27: an original version and a modified version. The modified version has added a field to the table compared to the original version. In this example, the Compare-NAVApplicationObject cmdlet creates a delta file,TAB27.delta, that describes the difference that the extra field must be inserted into the table. Then, you use the Update-NAVApplicationObject cmdlet to apply the delta to target files.

Examples

EXAMPLE 1

Compare-NAVApplicationObject -OriginalPath .\demodata\ORIGINAL\*.txt -ModifiedPath .\demodata\MODIFIED\*.txt -DeltaPath .\demodata\DELTA\

          Processed 14 objects:
          Inserted   0 objects
          Deleted    1 objects
          Changed    4 objects
          Identical  9 objects
          Failed     0 objects

This example compares the text files in the MODIFIED folder to the baseline in the ORIGINAL folder. The result of the comparison is put into the DELTA folder. When the comparison completes, a summary is shown.

EXAMPLE 2

Compare-NAVApplicationObject -OriginalPath .\demodata\ORIGINAL\*.txt -ModifiedPath .\demodata\MODIFIED\*.txt -DeltaPath .\demodata\DELTA -Force -PassThru |
          Update-NAVApplicationObject -TargetPath .\demodata\TARGET\*.txt -ResultPath .\demodata\RESULT -Force

          Processed 14 objects:
          Inserted   0 objects
          Deleted    1 objects
          Updated    3 objects
          Identical  9 objects
          Conflict   1 objects
          Failed     0 objects

This example compares the text files in the MODIFIED folder to the baseline in the ORIGINAL folder. The result of the comparison is put into the DELTA folder and also piped to the Update-NAVApplicationObject cmdlet, which applies the updates. When the comparison completes, a summary is shown.

Parameters

-Confirm

Specifies that the user must confirm the process before the cmdlet runs.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DeltaPath

Specifies the folder where the result of the comparison between the two versions of application objects must be put. For example, to place the result of the comparison in the DELTA folder that is a subfolder to the current folder, type .\DELTA*.txt.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Delta

Parameter sets

(All)
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExportToNewSyntax

Export the application objects to the syntax supported by the Txt2Al converter.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the cmdlet to overwrite any existing files in the Delta folder.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IgnoreDocumentation

Specifies not to include the content of the documentation triggers in the objects as part of the comparison.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Legacy

Reduces the scope of the cmdlet. Do not set this parameter.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:DevBaseCompatibility

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ModifiedPath

Specifies the application objects that you want to compare to the original version.

For example, to compare all text files in the MODIFIED folder that is a subfolder to the current folder, type .\MODIFIED*.txt.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Modified

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoCodeCompression

Specifies if the files that are the result of the comparison must not be compressed.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OriginalPath

Specifies the application objects that are the baseline of the file comparison.

For example, to use all text files in the ORIGINAL folder that is a subfolder to the current folder, type .\ORIGINAL*.txt.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Original

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Specifies if the cmdlet must return a FileInfo object for each .delta file that is created by the comparison. If you do not set this parameter, the cmdlet returns a list of the files.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

None or an object representing the .DELTA file that was created.

When you set the PassThru parameter, the Compare-NavApplicationObject cmdlet returns a FileInfo object for each created .DELTA file. Otherwise, this cmdlet does not generate any output.