【BluePrism】 컬렉션을 비교하여 차이 추출 및 중복 레코드 삭제
Base Collection

Target Collection

에 대응한다고 합니다.
두 개의 컬렉션을 비교하고 위의 필드에 동일한 매개 변수의 레코드가있는 경우
레코드 삭제 & 차등 추출할 객체를 만들었습니다.
개요도

실행 결과
비교원과 비교 대상의 컬렉션의 차분 추출, 중복 레코드를 삭제한 결과는 이하와 같습니다.
Base Collection의 필드 1~3을 대상으로 하고, 대응하는 Target Collection의 Field1~3을 비교한 결과입니다.
Result Base Collection
Base Collection과 Target Collection에서 중복되지 않은 레코드를 추출한 컬렉션입니다.
추출 소스의 컬렉션은 Base Colelction입니다.

Result Target Collection
Base Collection과 Target Collection에서 중복되지 않은 레코드를 추출한 컬렉션입니다.
추출 소스의 컬렉션은 Target Colelction입니다.

Duplicate Collection
Base Collection 및 Target Collection에서 중복 레코드를 추출한 컬렉션입니다.
추출 소스의 컬렉션은 Target Colelction입니다.

객체 설명
전체 객체 흐름

입력
Base Field와 Target Field가 일치하도록 필드 이름을 설정합니다.
Base Field1과 Target Field1은 입력 필수입니다.

Output
코드
Base Collection의 레코드 중복을 제외한 후 Collection을 기반으로
Target Collection과의 대응하는 필드와 비교해 차등 추출, 중복 삭제를 실시하고 있습니다.
Try
If Base_Field1 = "" Or Target_Field1 = "" Then
Success = False
Message = "Base_Field1, Target_Field1は必須項目です。"
Exit Sub
End If
Dim NewBase_Collection As DataTable
NewBase_Collection = Base_Collection.Clone
Dim count As Long = 0
For Each r1 As DataRow In Base_Collection.Rows
If count = 0 Then
NewBase_Collection.ImportRow(r1)
Else
Dim find_rows As DataRow()
find_rows = NewBase_Collection.Select(Base_Field1 & " = '" & r1(Base_Field1) & "'" & _
If(Base_Field2 <> "", " AND " & Base_Field2 & " = '" & r1(Base_Field2) & "'", "") & _
If(Base_Field3 <> "", " AND " & Base_Field3 & " = '" & r1(Base_Field3) & "'", ""))
If find_rows.Length = 0 Then
NewBase_Collection.ImportRow(r1)
End If
End If
count = count + 1
Next
Dim Tmp_Duplicate_Collection, Tmp_Result_Target_Collection, Tmp_NewBase_Collection As DataTable
Tmp_Duplicate_Collection = Target_Collection.Clone
Tmp_Result_Target_Collection = Target_Collection.copy()
Tmp_NewBase_Collection = NewBase_Collection.Clone
For Each r2 As DataRow In NewBase_Collection.Rows
Dim find_rows As DataRow()
find_rows = Tmp_Result_Target_Collection.Select(Target_Field1 & " = '" & r2(Base_Field1) & "'" & _
If(Target_Field2 <> "", " AND " & Target_Field2 & " = '" & r2(Base_Field2) & "'", "") & _
If(Target_Field3 <> "", " AND " & Target_Field3 & " = '" & r2(Base_Field3) & "'", ""))
If find_rows.Length <> 0 Then
' Base_CollectionにもTarget_Collectionにも存在する場合
For Each r3 As DataRow In find_rows
Tmp_Duplicate_Collection.ImportRow(r3)
r3.Delete()
Next
Else
Tmp_NewBase_Collection.ImportRow(r2)
End If
Next
Duplicate_Collection = Tmp_Duplicate_Collection.DefaultView.ToTable
Result_Target_Collection = Tmp_Result_Target_Collection.DefaultView.ToTable
Result_Base_Collection = Tmp_NewBase_Collection.DefaultView.ToTable
Success = True
Message = ""
Catch e As Exception
Success = False
Message = e.Message
End Try
샘플
htps : // 기주 b. 코 m / 후 lcs b / b p sm / t ree / 코 c 치온
BPA 객체 - 컬렉션 차이 비교.xml
Reference
이 문제에 관하여(【BluePrism】 컬렉션을 비교하여 차이 추출 및 중복 레코드 삭제), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/irohamaru/items/b4e0442c180cd9c74a4f텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)