1545
Views
11
Comments
Solved
How to use composite key?
Question

Hello, Is there any way to accomplish composite key feature?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

You can however simulate composite keys by adding a composite, unique index using the attributes.

2022-05-18 07-58-50
Pradip Chavhan

Hi Killian,

As you said can we use multiple indexes as composite key for a table?

Thanks,

Pradip Chavhan.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
2019-07-08 11-04-35
Leonardo Fernandes
 
MVP

Hello Dubey. In OutSystems, it's not possible to have composite keys. OutSystems promotes the use of surrogate keys, instead of natural keys, and with that approach there's no need to use composite keys. Please read this article to understand the differences between those types of keys.

If you need to integrate with an existing model, then OutSystems is able to import the composite keys, but they won't be considered as keys by the platform. You will still be able to use them for joins and take advantage of indexes and query optimizations.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

You can however simulate composite keys by adding a composite, unique index using the attributes.

2022-05-18 07-58-50
Pradip Chavhan

Hi Killian,

As you said can we use multiple indexes as composite key for a table?

Thanks,

Pradip Chavhan.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
2023-02-10 10-15-37
Pradeep Dubey

Thanks Kilian

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

You're most welcome :)

UserImage.jpg
Larry Mills

Ok, thank you.

Where do I create the composite unique index?  Then how?  Is this done in the extension?

Thank you.


UserImage.jpg
Larry Mills

All my data is on external databases - SQL Server.

Adding an index is greyed out - option only available for entities defined in OS.

Any ideas?

2022-10-14 16-09-19
Emman Si

Hi Larry,


From what I know you can define indexes from management studio of your external database.


Hope this helps!

- Emman

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Larry,

Like Emman says, indexes in external databases are managed in the external databases, not by OutSystems (just like everything else, you can't change Attributes either, for example).

2023-02-10 10-15-37
Pradeep Dubey

Hello Pradip Chavhan.

Yes

Thanks,

Pradeep.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.