Has anyone successfully implemented a Compare and Merge using the MergeModel Object for Forward Engineering? I have a macro that calls both the MergeReport and DoMerge methods using a QuickLaunch created through the UI, but both methods just cause an application crash. I've tried it in version 11 and version 2017, and the same thing happens. I had created a case with Idera, but was wondering if anyone has successfully done this.
Were you able to get any information from support on this? I've been able to successfully run a compare against a live database to generate an alter script.
No, I haven't heard anything from support. Can you post your macro?
Here's the macro I'm using. You might want to see if maybe it's a permission issue on one of the folders you're accessing. I worked with someone where certain macros didn't work on some machines but worked fine on others. If you are able, try running your macro on a different machine and see if you still get the same problem.
' compare and merge
Const IGNORE As Integer = 0
Const MERGE_ALL_TO_TARGET As Integer = 1
Const MERGE_ALL_TO_CURRENT As Integer = 2
Const FILE_PATH = "C:\temp\CM\"
Dim theDiagram As Diagram
Dim theModel As Model
Dim fileName As String
Dim DataModelFileName As String
Dim QuickLaunchFileName As String
Dim ComparisonReportFileName As String
On Error GoTo errHandler
QuickLaunchFileName = FILE_PATH & "compare.cmo"
ComparisonReportFileName = FILE_PATH & "lsip_diff.rtf"
Set theDiagram = DiagramManager.ActiveDiagram
Private Sub doCompare(QuickLaunchFileName As String, ComparisonReportFileName As String, Decision As Integer)
Dim theMergeObj As MergeModel
Set theModel = theDiagram.ActiveModel
Set theMergeObj = theDiagram.MergeModelObject
theMergeObj.MergeReport(QuickLaunchFileName, ComparisonReportFileName,1, 0)
Function CheckOp(Optional opRetVal As Variant = Nothing)
Dim errorCode As Integer
errorCode = DiagramManager.GetLastErrorCode()
If (errorCode <> 0) Then
Err.Raise Number := vbObjectError + errorCode, _
Source := "Macro error handler", _
Description := DiagramManager.GetLastErrorString()
Hi Stanley, Thanks for sharing it.
May i know is is possible to achieve the compare and merge by connecting to database and browse the tables and column through macro. I am looking for a way to connect to a database (TeraData) from ER studio macro if its possible. Any sample code will be greatly appreciated.
I had this working a month ago, and now all it does is crash again. I've tried Stan's macro above with a .CMO file generated using ER Studio, and Stan's macro crashes too. I have been trying to automate the Compare and Merge for 2 years now, and it seems like it will work for some periods, and then suddenly it will start crashing. Given the inconsistent nature of this feature sometimes working and sometimes crashing, it would seem like there are outside forces at work since I have not upgraded ER Studio in the last month. Is it possible there are Windows components being used by the MergeObject that are not used by the ER Studio UI, and that might be causing the crashes? This is beyond frustrating.
Hi Sue. Please log a ticket with support as it will require detailed investigation to try to pin down the underlying cause..
Hi Ron, I had already opened a case (00568055) over 2 years ago - should I open another?
HI Sue. I just looked at it. For some reason it is closed and wasn't logged in the Jira system that development and I work from. Apologies, but I don't know why. Please log another, referencing the original case and indicate that it needs to be forwarded to development as per discussion with me. Sorry for the inconvenience.
OK thanks Ron, will do.