training 6.6 data queries and widgets 2

I am trying to add cast/crew to a movie but it is giving me this error. I walked all the steps i need to perform back but i don,t know why i cannot add cast/crew. Can somebody please help me. Thank you 

Rank: #1348

Basically, as per my understanding, You are trying to add the same person to the same movie with the same role. Only, in that case, you will get such an exception. 

For example:- If I have Along Came Polly Movie And Alan Rickman as Director, And if I try to do the same I'll get the exception. So That is what the requirement was Like the same person with the same role in the same movie should not get added. Also, You can customize this error feedback message. Look below i have done that

I will explain a bit actually in exceptional handling you are showing the exception that is getting raised.

But in the course, it is suggested to use such exceptional handling so that we can over hide the exception with a customized feedback message

Rank: #128

As to why your UI is not showing the persons in a movie, that's down to a wrong filter in you aggregate

When you add multiple filters to an aggregate, all of them have to be true at the  same time.  (like an AND in SQL)

Do you aggregates will only return results if a person in a single personmovierole record is both director and producer, that's not possible.

So replace this

with this

and you will see your directors and producers.  

As far as I can tell, the SQL for the actors and crew is already correct, right ?


Rank: #99


Can you share your data model with us? Your error is about an existing equal value already stored in the DB, and the index is set to unique (don't permit duplicates).


Best regards,

Ricardo M Pereira

Rank: #15482

Hi Ricardo,

thank you for the replay 

Rank: #15482


Sorry i send the wrong file. Thank you for the explanation Rui.

In the annex you will find my correct file.

Kind regards,



Rank: #15482

Hello Rui,

In the annex you will find the requested OML files. I also changed the name but it will not change at OSMDB data.

Kind regards,



Rank: #15482

This is the other file


Rank: #15482

This is the right file, but the file is on a different map and it will not allow me to place it under the map that i am using as my main


Rank: #1348

Hey Erdinc Burnik

As I can see in the exception you have attached, It says that the combination of movieId, PersonId, and PersonRoleId Should be unique every time.


1 If you want to keep the data unique, then Change the "CreatePersonMovieRole" Action with "CreateOrUpdatePersonMovieRole". 

2 If you want duplicate records of such combination then refer to the highlighted field marked as 2. And Change the value of Unique to No. 

  To open this Detailed popup. Double click on the MORE option available in the entity detail. which is highlighted as 3

After that change the value. Publish your code. and retry the action.

 Erdinc Burnik Kindly mark it as a solution if my suggestions are helpful.

Thanks & regards

Divya Nayak