Book a Demo

Author Topic: How to get (API) Cardinality set to element in GUI  (Read 4832 times)

pisokol

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
How to get (API) Cardinality set to element in GUI
« on: December 04, 2014, 02:25:01 am »
It is possible to get value of Cardinality sets to the element? (In GUI: choise element and next from menu Properties->Detail->Cardinality).
Localization for this value in repository is t_object.cardinality. It is possible to get this value using API? It is not the same value as Multiplicity.
(I write addin in c#)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to get (API) Cardinality set to element in
« Reply #1 on: December 04, 2014, 11:09:43 am »
Try Element.GetReferenceList("Cardinality")

q.

pisokol

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How to get (API) Cardinality set to element in
« Reply #2 on: December 04, 2014, 09:01:52 pm »
Hello quwerty:)
I tried and I had the error...
Error      5      'EA.IDualElement' does not contain a definition for 'GetReferenceList' and no extension method 'GetReferenceList' accepting a first argument of type 'EA.IDualElement' could be found (are you missing a using directive or an assembly reference?)
(I must to use EA v.9.3.921)
« Last Edit: December 04, 2014, 09:05:38 pm by pisokol »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to get (API) Cardinality set to element in
« Reply #3 on: December 04, 2014, 09:40:19 pm »
My bad: it's Repository.Get... and returns the predefined value list.

You may alternatively try Repository.SQLQuery("SELECT cardinality FROM t_object WHERE Object_ID = <id>")

q.
« Last Edit: December 04, 2014, 09:42:01 pm by qwerty »

pisokol

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How to get (API) Cardinality set to element in
« Reply #4 on: December 04, 2014, 10:13:07 pm »
Yes, of course. I used this solution, by SQLQuery, yesterday, and its works.
String str = Repository.SQLQuery("select t_object.Cardinality from t_object where t_object.ea_guid = \"" + e.ElementGUID + "\"");
But it is finality way for me. I try allways used API first.
Thx,
PS

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to get (API) Cardinality set to element in
« Reply #5 on: December 04, 2014, 10:33:57 pm »
Right that. Luckily there is this escape we can use where the API fails.

q.

pisokol

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How to get (API) Cardinality set to element in
« Reply #6 on: December 04, 2014, 11:35:48 pm »
thx for all informations and help