Hope you had a good understanding about table relations through my previous post. Today I will be explaining about the delete actions. I will be going along with the same scenario of Student Course Enrollment. There are three tables Student, Course and StudentCourseEnrollment.
Each of the record in table StudentCourseEnrollment will be child of both Student and Course. Obviously, when a student in enrolled in a course, his record will be present in the StudentCourseEnrollment table. In other words StudentCourseEnrollment table is related to table Student.What if someone deletes the Student whose referrence is in StudentCourseEnrollment table? That's where delete action plays their part in Dynamics AX.
In Dynamics AX 2012, We can define four delete actions on Student table. None, Cascade, Restricted and Cascade+Restricted. I am going to explain all of the four delete actions here.
Each of the record in table StudentCourseEnrollment will be child of both Student and Course. Obviously, when a student in enrolled in a course, his record will be present in the StudentCourseEnrollment table. In other words StudentCourseEnrollment table is related to table Student.What if someone deletes the Student whose referrence is in StudentCourseEnrollment table? That's where delete action plays their part in Dynamics AX.
In Dynamics AX 2012, We can define four delete actions on Student table. None, Cascade, Restricted and Cascade+Restricted. I am going to explain all of the four delete actions here.
- None: We would never like to keep the Delete Action None for the Student table because None means No action will take place on related records in the StudentEnrollment when you delete a record in the Student table.
- Cascade: All records in StudentCourseEnrollment table related to the record being deleted in Student table will also be deleted.
- Restricted: The user will get a warning saying that the record in the Student table cannot be deleted because transactions exist in table Student Course Enrollment table. The user will be unable to delete the record in Student table if one or more related records exist in the Student Course Enrollment table.
- Cascade + Restricted: The delete action performs a restricted, if the record of the table will be deleted directly and peforms a cascade, if the record of the table will be deleted through a cascade delete action of another table. Let's say for example we have a student table which is also the child table of Department table. What if we have defined Cascade delete action in Department table for Student table. All the related records of the Student will be deleted and provided if we have defined "Cascade+Restricted" in the Student table for Student Course Enrollment table then all the data in course enrollment table will also be deleted. However, it will behave as Restricted delete action if there is no any other table where we have defined Cascade delete action for Student table.
Hope this scenario based explanation clears your concepts regarding Delete Actions.
No comments:
Post a Comment