Book a Demo

Author Topic: How can I list field choice of a field in add-in?  (Read 6957 times)

harbourfish

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
How can I list field choice of a field in add-in?
« on: May 26, 2010, 06:04:26 pm »
 :'([size=11]I'm developing a C# Add in. Now I need to list some field choices of a field. for example, there is a requirement item in Requirements Model package in EA. Double click the item, it will display some properties of the item. like Status, Difficulty, Priority and so on. I call them "fields".In these fields, they contains some field choices. As Status field, it contains "Approved", "Implemented", "Mandotory" and so on. So how could I get all these fields and their choices in my code?
Which methods provided by EA I could use to get all these information?
Thx in advanced.[/size]

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How can I list field choice of a field in add-
« Reply #1 on: May 26, 2010, 06:41:05 pm »
Well, it depends.
If the values for those fields can be managed they are stored in the database. In that case you can get them either by using Repository.GetReferenceList() or by querying them from the database directly using Repository.SQLQuery().

Geert

harbourfish

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: How can I list field choice of a field in add-
« Reply #2 on: May 26, 2010, 07:54:51 pm »
Quote
Well, it depends.
If the values for those fields can be managed they are stored in the database. In that case you can get them either by using Repository.GetReferenceList() or by querying them from the database directly using Repository.SQLQuery().

Geert

_____________________________________

Thx.For the field named Status in the Property Page of a Requirement item metioned above, How to get the values of this field, Could you give me some code sample?

harbourfish

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: How can I list field choice of a field in add-
« Reply #3 on: May 27, 2010, 06:08:21 pm »
Can anyone show me the sample code. I just want get the information of the field named "Status", such as its type, its name and so on, and get all the values of it. Can anyone can show me? Thank you in advanced.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How can I list field choice of a field in add-
« Reply #4 on: May 27, 2010, 07:05:55 pm »
Have you tried Repository.GetReferenceList("Status")?

Geert

harbourfish

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: How can I list field choice of a field in add-
« Reply #5 on: June 02, 2010, 06:00:26 pm »
It seems "Status" is okay. But when I try to get the values of "Difficulty", error occurs. So how to get all the values of other fields, like "Difficulty", "Priority" and so on. It turns out a trouble for me.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How can I list field choice of a field in add-
« Reply #6 on: June 02, 2010, 06:11:53 pm »
Hi,

Have you looked at the API documentation regarding GetReferenceList()?
I don't see "Difficulty" as an allowed value, so no wonder you get an error.
As mentioned before, only the values that are managed in the database can be requested this way.
Other value types often are hardcoded.

Geert

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: How can I list field choice of a field in add-
« Reply #7 on: June 02, 2010, 06:23:16 pm »
Hi
The difficulty and priority fields are stored in the PDATA3 and PDATA2 fields in the t_object table.

HTH
Using V12

harbourfish

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: How can I list field choice of a field in add-
« Reply #8 on: June 02, 2010, 06:27:17 pm »
Quote
Hi,

Have you looked at the API documentation regarding GetReferenceList()?
I don't see "Difficulty" as an allowed value, so no wonder you get an error.
As mentioned before, only the values that are managed in the database can be requested this way.
Other value types often are hardcoded.

Geert
----------------------------------------------
Okay. Thank you very much. I did realize most of these fields needs to be hardcoded if no other ways getting values of them, but I'm not sure about it.

harbourfish

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: How can I list field choice of a field in add-
« Reply #9 on: June 02, 2010, 06:46:24 pm »
Quote
Hi
The difficulty and priority fields are stored in the PDATA3 and PDATA2 fields in the t_object table.

HTH
-----------------------------
I call R.SQLQuery() to get the XML String. But I found that it only displays the specified value in a specified item. I think you make misunderstanding about it. What I want is that the difficulty field and priority field contain which values? I want to list all the optional values of one field.

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: How can I list field choice of a field in add-
« Reply #10 on: June 02, 2010, 07:05:41 pm »
Hi
In that case Geert is correct - these values dont appear in the DB
Using V12

harbourfish

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: How can I list field choice of a field in add-
« Reply #11 on: June 02, 2010, 07:07:36 pm »
Quote
Hi
In that case Geert is correct - these values dont appear in the DB
-------------------------------
Anyway,Thank you very much.