Author Topic: How to add a table column with a specified type?  (Read 7363 times)

chrvi

  • EA User
  • **
  • Posts: 75
  • Karma: +0/-0
  • There are so many hidden features...
    • View Profile
How to add a table column with a specified type?
« on: July 13, 2007, 05:39:19 am »
Hello,

via automation interface I've added a new table (element of the type class with a "table" stereotype) and I set its GenType to MySQL.
However, when I add (through automation) a new attribute (i.e. table column) to this table and I set its type to (let's say) Decimal, I can see the new column in EA within the table columns with the type I gave to it (I mean in the "Columns" list at the bottom of th given attribute window) but in the upper part of the window (the part with the given column info details) I have no data type assigned.

Do I have to assign a particular database name to all the columns somehow? Or what else is needed to assign the column's type to the desired database (if setting database name on the table's genType isn't enough) to make this type visible in the column properties window?

Thanks.
« Last Edit: July 13, 2007, 05:40:29 am by chrvi »
Radek

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to add a table column with a specified typ
« Reply #1 on: July 13, 2007, 06:22:05 am »
Try setting EA's default DBMS in the Settings | Database Datatypes dialog. Strangely enough, EA does not set the drop-down list to the default dialog when the above dialog opens. You have to 'test' each one.

This might have no effect on tables through automation, but it certainly helps via the UI.

David
No, you can't have it!

chrvi

  • EA User
  • **
  • Posts: 75
  • Karma: +0/-0
  • There are so many hidden features...
    • View Profile
Re: How to add a table column with a specified typ
« Reply #2 on: July 13, 2007, 07:15:00 am »
It's all rather strange...

When I double click on the table column in Project Explorer, the column seems to have no datatype and no datatype can be selected as though the table doesn't have a genType assigned.
Nevertheless if I click on the table in Project Explorer and display the columns from the second tab of the table window, I can see all the columns WITH datatypes assigned and what's more - when I close the table window now and double click the table column directly in Project Explorer again (the same procedure as in the very beginning), suddenly the column displays its datatype correctly.

Pretty weird I think :-)

Can this be avoided somehow?
« Last Edit: July 13, 2007, 07:17:29 am by chrvi »
Radek

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to add a table column with a specified typ
« Reply #3 on: July 13, 2007, 07:26:43 am »
In your automation project, did you call both Update() on the column and Refresh() on the Attributes() collection of the table?
No, you can't have it!

chrvi

  • EA User
  • **
  • Posts: 75
  • Karma: +0/-0
  • There are so many hidden features...
    • View Profile
Re: How to add a table column with a specified typ
« Reply #4 on: July 13, 2007, 07:26:49 am »
By the way, unless I find some solution I will for example see only question marks instead of data types as my Index "parameters" in Project Explorer...

I mean, instead of <<index>>MyIndex(DATE,INT) in Project Explorer I can see only <<index>>MyIndex(?,?)
Radek

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to add a table column with a specified typ
« Reply #5 on: July 13, 2007, 07:28:20 am »
Even stranger...

What about refreshing the diagram? Does that help things to snap into focus?

You can do this from either the API or the UI.
No, you can't have it!

chrvi

  • EA User
  • **
  • Posts: 75
  • Karma: +0/-0
  • There are so many hidden features...
    • View Profile
Re: How to add a table column with a specified typ
« Reply #6 on: July 13, 2007, 07:36:09 am »
Emmm... I'm sorry but I didn't get it... What diagram shall I try to refresh?
Is there a special diagram (none of possible diagrams in a user's model) I can access and work with?

I haven't worked with diagrams in any way so far in EA so I'm rather confused.
Radek

chrvi

  • EA User
  • **
  • Posts: 75
  • Karma: +0/-0
  • There are so many hidden features...
    • View Profile
Re: How to add a table column with a specified typ
« Reply #7 on: July 13, 2007, 08:22:34 am »
And yes, I call both - newAttribute.Update() and attributes.Refresh() as well once I create the new attribute and fill its data.

BTW Some time ago I had problems with the correct use of myCollection.Refresh(). Are there any limitations or recommendations when to call that method?
For example if I know I'll be adding 20 objects into myCollection shall I call myCollection.Refresh() immediately after each object is created or just once at the end when all the object were created?
Radek

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to add a table column with a specified typ
« Reply #8 on: July 13, 2007, 08:52:50 am »
AFAIK, and I've done this a lot, you only need to call Refresh() before you query the collection. Otherwise you run the risk of either: not finding your newly created objects (annoying but not necessarily serious) or getting the wrong object when you query by position (often silent and almost always serious).

What happened when you refreshed the diagram before double-clicking?

David
No, you can't have it!

chrvi

  • EA User
  • **
  • Posts: 75
  • Karma: +0/-0
  • There are so many hidden features...
    • View Profile
Re: How to add a table column with a specified typ
« Reply #9 on: July 13, 2007, 09:40:09 am »
I think I'm dumb (my favourite Nirvana song ;-) ) but what do you mean by refreshing the diagram?

I've only found the option "Reload current project" but this probably isn't what you mean...
I have no diagram in the package with all the tables...
« Last Edit: July 13, 2007, 09:40:34 am by chrvi »
Radek

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to add a table column with a specified typ
« Reply #10 on: July 13, 2007, 09:47:27 am »
I'll look for it, and update this post when I find the reference.

[EDIT: Repository.ReloadDiagram(long DiagramID)]

In the meantime, before you double-click anything on one of these diagrams, try right-clicking on the diagram tab (I don't think this is in the main menu, at least not in 6.5) and choose to reload the diagram. Let me know if there is any difference afterwards.

David
« Last Edit: July 13, 2007, 09:48:43 am by Midnight »
No, you can't have it!

chrvi

  • EA User
  • **
  • Posts: 75
  • Karma: +0/-0
  • There are so many hidden features...
    • View Profile
Re: How to add a table column with a specified typ
« Reply #11 on: July 13, 2007, 10:31:18 am »
I'm really sorry but I have no idea what you mean by "diagrams".

I've worked and checked everything in Project Explorer only.
I have just a package and a few tables in it.
I haven't created any diagram.
There my problem lies - whenever I display table column properties (by double clicking the table column in Project Explorer) the column datatype is empty.
On the contrary, if I display table properties (by double clicking the table in Project Explorer) and I look at the second tab (Table Detail) and select Column/Attributes, each column I select displays its datatype correctly.
If I double clicked any of the table columns directly in Project Explorer now, its datatype would be correctly displayed.



(P.S. I'm working with EA 6.5)
« Last Edit: July 13, 2007, 10:33:23 am by chrvi »
Radek

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to add a table column with a specified typ
« Reply #12 on: July 13, 2007, 10:46:36 am »
Quote
I'm really sorry but I have no idea what you mean by "diagrams".

My fault, I somehow just decided you had created diagrams.

Quote
On the contrary, if I display table properties (by double clicking the table in Project Explorer) and I look at the second tab (Table Detail) and select Column/Attributes, each column I select displays its datatype correctly.
If I double clicked any of the table columns directly in Project Explorer now, its datatype would be correctly displayed.

At least this seems contained.

I have not tried this trough automation in 7.0 yet. If I get a chance I'll let you know what happens.

David
No, you can't have it!

chrvi

  • EA User
  • **
  • Posts: 75
  • Karma: +0/-0
  • There are so many hidden features...
    • View Profile
Re: How to add a table column with a specified typ
« Reply #13 on: July 13, 2007, 10:58:42 am »
That'd be fine.

It seems to me quite strange behaviour and I wouldn't be surprised if it was a matter of some forgotten property in my code when creating tables and their columns.
Nevertheless I have no idea what to do with it at the moment...

Radek
Radek