Reputation: 15
I would like to know if it is possible to achieve dynamic key constraints based on user selections in Power Platform Dataverse.
For example, I have a Student
table with four columns:
ID | Student | Course | Lecturer | Unit |
---|---|---|---|---|
1 | Sam | Math | Andrew | Math_1 |
2 | Sam | English | Andrew | English_1 |
3 | Lily | Math | Jack | Math_1 |
4 | Lily | Math | Jack | Math_2 |
5 | Dona | Math | Ben | Math_1 |
Normally, I want the [Student]
and [Course]
as a composite key (means they are unique), see the 1 and 2, if they select the "Jack" as the lecturer, I want the [Student]
, [Course]
and [Lecturer]
as a composite key.
So:
[Student]
and [Course]
[Lecturer]
Does anyone have any ideas how to do this?
Thank you
Upvotes: 0
Views: 122
Reputation: 409
In the above table you have given, you should add all 4 fields except ID as composite key to achieve the result.
Assuming combo of Sam,English,Andrew, English_1 is always unique.
Edit: Another option is as below.
Keep student+course in a table called course registration. Add both fields as composite alternate key.
And have another table called lesson schedule
Which has foreign key of course registration & lecturer & lesson. So u can add these 3 coulmns as unique key if need be.
Upvotes: 0