Why I have this error messagr

Why I have this error message when I try to delete a record

Why I have this error message when I try to delete the record

Here the file

If I try to assign people to people interew people inputs, it not updated in the register people screen. Why is this so?

Theow Meng Ang wrote:

Why I have this error message when I try to delete the record


You have a foreign key in your people record. The delete rule for that attribute states "protect". So when you have an actual interview assigned to the person you want to delete the database prevents that. 

Theow Meng Ang wrote:

If I try to assign people to people interew people inputs, it not updated in the register people screen. Why is this so?

On your Save Action you actually use the "Create" Action of the entity. Try using the CreateOrUpdate Action. I think it may be not updated because everytime you do a save you create a new record in the db.

Maybe I mistook your question. The next possible answer could be: the interview is not assigned to your table. You only take the result from the GetPersons. The result of GetPersonToInterviewPeopleByCandidateId is not used.


So how am I going to delete this record? Is there any way to delete this record

Theow Meng Ang wrote:

So how am I going to delete this record? Is there any way to delete this record

If you want database integrity try setting the delete rule to "delete". However that will delete the interview assigned as well.

If you don't want that use the rule "ignore". It will keep the interview. But be aware that you won't be able to access it via a person anymore since the person won't exist.


Thanks

Hi Theow,

In general, what you want to do, is have an IsActive flag in the record, and set that to False. Thus, the relational integrity of your database remains intact. This is called a "soft delete", as opposed to a "hard delete" using the DeleteXxx Entity Action.

No...I think I don't need this boolean expression as the user can just decide whether to delete it or not to delete. Thanks.

Hi Theow,

Yes, you do need that boolean because that is a best practice. Of course, you can decide that you know it better than anyone else, but in that case, please stop asking questions.

There are a number of very good reasons to use a soft delete instead of a hard delete. One of the reasons is the exact same scenario that you don't understand and you are asking about here: when you use the Id of a record elsewhere, then you cannot safely delete the record. Referential integrity of your database is important!!! If you don't understand that, then perhaps you shouldn't be writing software.

Also, saying "the user can decide" is about the silliest thing you can say. The user cannot decide these things, as the user doesn't understand, and doesn't need to understand, things like referential integrity. It is you, the developer, who has to think about it!