Checking for duplicate entries

Checking for duplicate entries

I am using the below script, which I would think would work as intended, however there is something going on with the Name field. When I strip down the code to only check for Shift Start and Event, then it works fine. As soon as I add the Name field, it stop's catching duplicates.

if(Hours_Entry[Shift_Start == input.Shift_Start && Event == input.Event && Name == input.Name].count() != 0)
{
input.Poss_Duplicate = true;
alert "True";
cancel submit;
}
else
{
alert "False";
cancel submit;
}