Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: ufechner on July 18, 2005, 06:25:41 pm
-
Hello,
I imported the type library with delphi and I am working fine with the EAProject component.
Now I try to use the repository component and have the following problem:
procedure TfrmMain.Button1Click(Sender: TObject);
var
oElement: IDualElement;
sTmp,sGUID: string;
boResult: boolean;
iCount: integer;
begin
boResult:=self.EARepository.OpenFile(edtInputFile.Text);
if boResult then begin
iCount:=self.EARepository.Models.Count;
self.foMyUserIO.outLog('ModelCount: '+inttostr(iCount), ltMsg);
sGUID:='EAID_6AB8AFBB_2217_4f0f_979D_59200D08976D';
oElement:=EARepository.GetElementByGuid(sGUID);
//oElement:=EARepository.GetElementByGuid(self.edtElementID.Text);
if oElement<>nil then begin
sTmp:=oElement.Name;
end;
end;
end;
If I execute this code, oElement is always NIL.
(The GUID exists, and it is a class element.)
Any idea?
Reagards:
Uwe Fechner
-
Just guessing here, but it looks like you've got your guid from an xmi export. It won't actually be in that form in the Repository.
Try '{6AB8AFBB_2217_4f0f_979D_59200D08976D}' instead.
Simon
-
Hello,
your hint did help, but your suggestion was still wrong.
Wrong: '{6AB8AFBB_2217_4f0f_979D_59200D08976D}'
Right: '{6AB8AFBB-2217-4f0f-979D-59200D08976D}'
Why do you use different ways to represent GUID's in the project and in the repository interface?
PLEASE add a hint regarding this issue to the online help (documentation of methods of the automation interface).
Regards:
Uwe Fechner
-
Sorry, I missed that difference.
My guess is that the difference is because the DTD for XMI doesn't allow it in the form it's saved in the database.
Simon