Wednesday, 22 May 2019

Check Duplicate record exists in Array customize function - Angular

This is a function written in Type script to check in an Array that Whether duplicate record exists. this check placed where you add a row in Array.


 IsDuplicateExists(IdtoCheck, ArrList, ListColumnName): boolean {
    var i;
    for (i = 0; i < ArrList.length; i++) {
      if (ArrList[i][ListColumnName] == IdtoCheck) {
        return true;
      }
    }
    return false;
  }


Parameters Description

1. IdtoCheck
This can be Id or Name which you want to find.

2. ArrList
This is array object

3. ListColumnName
This is array column name, where system find IdtoCheck

No comments:

Post a Comment