on 03-14-2018 9:19 AM
Hi,
I want to compare two versions of a Conceptual Data Model. The in-built compare model option doesn't work for me because i want to add custom filters for comparison. Example: If the data type of a column A has changed from BOOLEAN to CHAR, then only it should be marked as a difference in attributes and not in case of any other data types.
Please help me to know how can i achieve this.
--Thanks
Amit
I haven't got time at the moment to check this out, but I reckon there's a method somewhere that will load a "comparison settings set", which you do before invoking the compare method.
...
OK, take a look at these objects in the metamodel:
ComparisonHelper
ComparisonAction
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found some script samples in the Help - see "ComparisonHelper". Using that I was able to construct the following script which should restrict the comparison to Domains.
Dim newModel, oldModel, idx
Set oldModel = OpenModel("\Playpen\Comparison Test - original domains.cdm", Omf_Hidden)
Set newModel = OpenModel("\Playpen\Comparison Test - changed domains.cdm", Omf_Hidden)
output oldModel
output newModel
' Create a comparison Helper
Dim ComparisonHelper
Set ComparisonHelper = OldModel.CreateComparisonHelper(newModel)
ComparisonHelper.SetClassComparable "*", FALSE ' turn off all comparisons
ComparisonHelper.SetClassComparable "Domain", TRUE ' turn on domains
ComparisonHelper.SetPropertyComparable "*", "Length", TRUE
output " =====Difference Count is:" & ComparisonHelper.GetDifferencesCount()
' Loop on difference
Dim DiffKind, OldObject, NewObject, MemberPublicName, OldValue, NewValue, Str
for Idx = 0 to ComparisonHelper.GetDifferencesCount()
ComparisonHelper.GetDifferenceInformation Idx, DiffKind, OldObject, NewObject, MemberPublicName, OldValue, NewValue
Str = "Difference #" & cstr(Idx) & " is:"
Str = Str & " Kind=" & Cstr(DiffKind)
if not OldObject is nothing then
Str = Str & " Old object=" & cstr(OldObject)
end if
if not NewObject is nothing then
Str = Str & " New object=" & cstr(NewObject)
end if
Str = Str & " Modified property=" & MemberPublicName
Str = Str & " Old=" & cstr(OldValue)
Str = Str & " New=" & cstr(NewValue)
output Str
Next ' difference
' close models without saving
newModel.Close(False)
oldModel.Close(False)
Unfortunately, the line that's supposed to enable comparisons for domains doesn't have that effect:
ComparisonHelper.SetClassComparable "Domain", TRUE
Perhaps I've misunderstood.
User | Count |
---|---|
75 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.