Book a Demo

Author Topic: Doubt about Unique Compound Constraits  (Read 4081 times)

Rasec

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Doubt about Unique Compound Constraits
« on: November 08, 2008, 05:43:33 am »
Hello,
 
I'd like to know how can i declare two attributes unique in my Logical Model class to generate an unique compound constraint in the database? I know how to set unique in Tagged values, but i don't know how can i set two attributes to be compound when i generate the script for database.
Any idea? I really need help with this because i can't find any reference about how to do.

An example of what i need is:

Suppose i have a SECTOR table with column CODE and ID_DEPARTMENT. Made them unique and compound i will never have any equal data in CODE and ID_DEPARTMENT when search together.
 
I hope I have managed to explain my problem.  ;)
 
Thanks
Rasec
« Last Edit: November 08, 2008, 05:45:17 am by rasec »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Doubt about Unique Compound Constraits
« Reply #1 on: November 09, 2008, 12:01:57 am »
Set up an index (perhaps the documentation files this under "key" so check both). When you set up the columns and such you will also be able to add a unique constraint. [I don't have EA on this machine, and I cannot remember exactly.]

It might be that you need to add this as a constraint instead. It's there in the EA help, you just need to look for it.

This is one of those things that is easier when you get the hang of how EA does things with databases. Of course when you've gotten the hang of it you've probably already got all the answers...

HTH, David

PS: If you really cannot find it post back. One of us will have been working in this area - or I'll be working on my EA box - and you will get an answer. But in the meantime see if the above doesn't get you unstuck.
No, you can't have it!

Rasec

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Doubt about Unique Compound Constraits
« Reply #2 on: November 11, 2008, 02:33:49 am »
Quote
Set up an index (perhaps the documentation files this under "key" so check both). When you set up the columns and such you will also be able to add a unique constraint. [I don't have EA on this machine, and I cannot remember exactly.]

It might be that you need to add this as a constraint instead. It's there in the EA help, you just need to look for it.

This is one of those things that is easier when you get the hang of how EA does things with databases. Of course when you've gotten the hang of it you've probably already got all the answers...

HTH, David

PS: If you really cannot find it post back. One of us will have been working in this area - or I'll be working on my EA box - and you will get an answer. But in the meantime see if the above doesn't get you unstuck.
Thanks David,

I will try this right now.
If doesn't work i will post again to see if there other solutions.

Thanks a lot again.


Rasec

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Doubt about Unique Compound Constraits
« Reply #3 on: November 11, 2008, 10:59:51 pm »
Quote
PS: If you really cannot find it post back. One of us will have been working in this area - or I'll be working on my EA box - and you will get an answer. But in the meantime see if the above doesn't get you unstuck.
Hello «Midnight».
I tried this in my Logical Diagram, but i think this solution doesn't fit with Logical Model. I tried to create this index, but i can't associate with a column and set unique constraint.
There is a solution for my Logical Diagram problem?
I mean, how could create a unique compound attributes to generate my code and database with this type of constraint.

Thanks!

hd

  • EA Administrator
  • EA User
  • *****
  • Posts: 312
  • Karma: +0/-0
    • View Profile
Re: Doubt about Unique Compound Constraits
« Reply #4 on: November 12, 2008, 08:02:28 am »
To set a unique "compound" (composite) constraint...

  • Select the table and add an operation [F10] with stereotype <unique> and Save.
  • Select the <unique> operation in the Operations list, select the Columns to add the columns.
Use the same steps for a composite index.

To set the index as unique, select the <index> operation in the Operations list, click on [Extended Properties...], and check the
  • Unique checkbox.

Rasec

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Doubt about Unique Compound Constraits
« Reply #5 on: November 12, 2008, 10:33:37 pm »
Quote
To set a unique "compound" (composite) constraint...

  • Select the table and add an operation [F10] with stereotype <unique> and Save.
  • Select the <unique> operation in the Operations list, select the Columns to add the columns.
Use the same steps for a composite index.

To set the index as unique, select the <index> operation in the Operations list, click on [Extended Properties...], and check the
  • Unique checkbox.
I got it. In my Database Model i can do that and works!
But i need to do this in my Class Model. In Operation window i don't have how to specify the column either an attribute. So, i i need to specify an Unique Compoud Constraint in my Class Model to generate the database script with this constraint, how can i proceed? I don't know what i need to configure.

Thanks!!

Rasec

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Doubt about Unique Compound Constraits
« Reply #6 on: November 17, 2008, 10:21:08 pm »
Any idea how can i create unique compound constraints in my Class Model? I have one class that's have others declarated objects. I need to create a unique compound constraints for this objects.
But i need to do this only in my Class Model. All the others models it's ok.

Thanks!