Removing duplicate records based on a column and condition on other column on CDT

Hi All,

I am new to Appian programming, and here I need your help; I have CDT, and based on the below screenshot, I need to remove the 5th record based on the following conditions.

The Person id duplicates, and ChildCustodialTypeId is NULL. In this scenario 5 the record I want to get rid of when I call the CDT, so please let me know how I could do this successfully.

  Discussion posts and replies are publicly visible