Customization > Automation Interface > Functions > For User Interface > Functions for Model Differencer > DiffModel function (automation interface)
  
DiffModel function (automation interface)
Syntax:
Set objMM = CreateObject("Studio.ModelManager")
Call objMM.DiffModel ("<source model reference>", <diff type>, "<target model reference>", "<report path and file name>", <close differencer>)
Where:
<source model reference> specifies the Reference property of the source model, as displayed on the General tab of the model's property pages. The case of the reference must be correct.
<diff type> specifies the type of difference that is being performed:
1. specifies that a source sandbox is differenced against the version of the trunk from which the sandbox was created. When set to 1, the target model reference is ignored.
2. specifies that a source sandbox is differenced against the latest version of the trunk from which the sandbox was created. When set to 2, the target model reference is ignored.
3. specifies that the source model version is differenced against its preceding model version. When set to 3, the target model reference is ignored.
4. specifies that the source model version is differenced against the target model version, which must be a different version of the same model.
5. specifies that the source model version is differenced against the target model version, which can be in another repository.
<target model reference> specifies the Reference property of the target model, as displayed on the General tab of the model's property pages. The case of the reference must be correct. The target model reference is used only when the diff type is set to 4 or 5.
<report path and file name> specifies the path and file name for the XML difference report.
<close differencer> specifies whether Model Differencer remains open after the XML difference report is generated. TRUE means that Model Differencer is closed after the XML report is generated, FALSE means Model Differencer remains open after the XML report is generated.
The DiffModel function generates model XML difference reports through Model Differencer. You can optionally leave Model Differencer open after generating the difference report.
This function returns -1 if any errors are encountered, or the number of differences encountered if there are no errors.
Note that you can use the DiffPackage function to compare a Package with another Package.
Examples
In this example, version 2 of Model One is differenced against version 3 of Model Two. The report is generated to a file named DiffResult.xml. Model Differencer is closed after the report is generated.
Set objMM = CreateObject("Studio.ModelManager")
Call objMM.DiffModel ("\\SQL\My Repository\My Models\Model One\2", 5, "\\SQL\My Repository\My Models\Model Two\3", "c:\reports\DiffResult.xml",TRUE)