Author Topic: Using the repository in Delphi  (Read 4768 times)

ufechner

  • EA User
  • **
  • Posts: 85
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Using the repository in Delphi
« 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

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Using the repository in Delphi
« Reply #1 on: July 19, 2005, 03:22:57 pm »
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

ufechner

  • EA User
  • **
  • Posts: 85
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: Using the repository in Delphi
« Reply #2 on: July 22, 2005, 05:26:01 am »
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
« Last Edit: July 22, 2005, 05:26:40 am by ufechner »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Using the repository in Delphi
« Reply #3 on: July 24, 2005, 03:40:26 pm »
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