if the current record is complex, has a non-null sublist, and the first record of that sublist is not complex, then the current record must be a record of a client, so

if(complex(ptr))

if(sublist(ptr) != null)

if(!complex(sublist(ptr)))