Author Topic: How to find Instances of a Class  (Read 8048 times)

Viking

  • EA User
  • **
  • Posts: 453
  • Karma: +2/-2
    • View Profile
Re: How to find Instances of a Class
« Reply #15 on: June 16, 2020, 11:22:13 pm »
Hello,
I want to assign the GUID of a classifier to an instance.
Code: [Select]
anInstance.ClassifierID = anElement.ElementGUID;I thought that both are strings and that it will work. It didn’t. The documentation says that ClassifierID is a Long an ElementGUID is a String. When I look into the database ea_guid and Classifier_guid look the same.
What’s wrong? V.
« Last Edit: June 16, 2020, 11:46:50 pm by Viking »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: How to find Instances of a Class
« Reply #16 on: June 16, 2020, 11:26:09 pm »
Hello,
I want to assign the GUID of a classifier to an instance.
Code: [Select]
anInstance.ClassifierID = anElement.ElementGUID;I thought that both are strings and that it will work. It didn’t. The documentation says that ClassifierID is a Long an ElementGUID is a String. When I look into the database ea_guid and Classifier_guid look the same.
Anyway. So I tried this:
Code: [Select]
anInstance.ClassifierID = Int16.Parse(anElement.ElementGUID); and all other conversions. But that is not correct either. What’s wrong? V.
ClassifierID is NOT a GUID

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to find Instances of a Class
« Reply #17 on: June 17, 2020, 12:02:22 am »
It should be
Code: [Select]
anInstance.ClassifierID = anElement.ElementID
In EA most thing have both a regular ID (Long) as a guid (string)

The regular ID is (mostly) used to link things together, but they cannot be counted on to remain stable.
After say importing an xmi file, the ID's could be different. The ea_guid however will always stay the same.

In the database there is indeed also a field Classifier_guid, but you should not count on that. The real link is made using the Classifier column

Geert.

Viking

  • EA User
  • **
  • Posts: 453
  • Karma: +2/-2
    • View Profile
Re: How to find Instances of a Class
« Reply #18 on: June 17, 2020, 12:03:25 am »
Quote from: Paolo F Cantoni
ClassifierID is NOT a GUID
Paolo

Yes, I am sorry, my question was nonsense :(