Skip to content
Snippets Groups Projects
Commit 6ea5426a authored by David Büchler's avatar David Büchler
Browse files

Erste Version der Gesamtübersicht für Personendubletten erstellt. Diese zeigt...

Erste Version der Gesamtübersicht für Personendubletten erstellt. Diese zeigt die Namen der Personen und die Anzahl der DUbletten im Cluster an.
parent 4cfb19fa
No related branches found
No related tags found
No related merge requests found
......@@ -10,9 +10,12 @@
</entityProvider>
<entityField>
<name>CLUSTER_DESCRIPTION</name>
<title>Cluster description</title>
</entityField>
<entityField>
<name>COUNT_DUPLICATES_IN_CLUSTER</name>
<title>Count duplicates in cluster</title>
<contentType>NUMBER</contentType>
</entityField>
<entityField>
<name>TARGET_ENTITY</name>
......
import("system.db");
import("system.vars");
import("system.result");
var INDEX_ID = 0;
var INDEX_CLUSTERID = 1;
var INDEX_FIRSTNAME = 2;
var INDEX_LASTNAME = 3;
let targetEntity = vars.get("$param.TargetEntity");
let duplicates = [];
if(targetEntity == "Person_entity")
{
duplicates.push([123, "Description of person cluster", 4, "Person_entity"]);
//duplicates.push([123, "Description of person cluster", 4, "Person_entity"]);
let personInfosQuery = "select DUPLICATECLUSTERS.ID, CLUSTERID, FIRSTNAME, LASTNAME"
+ " from DUPLICATECLUSTERS"
+ " join CONTACT on CONTACT.CONTACTID = DUPLICATEID"
+ " join PERSON on PERSON.PERSONID = CONTACT.PERSON_ID"
+ " ORDER BY CLUSTERID";
let personInfos = db.table(personInfosQuery);
let recordClusterId = "";
let recordDescription = "";
let recordDuplicateInClusterCount = 0;
for (let i = 0; i < personInfos.length; i++)
{
let currentClusterId = personInfos[i][INDEX_CLUSTERID];
let currentDescription = personInfos[i][INDEX_FIRSTNAME] + " " + personInfos[i][INDEX_LASTNAME];
if(i == 0)
{
recordClusterId = currentClusterId;
recordDescription = currentDescription;
recordDuplicateInClusterCount = 1;
continue;
}
if(recordClusterId == currentClusterId)
{
recordDescription += ", " + currentDescription;
recordDuplicateInClusterCount++;
}
else
{
let currentRecordId = personInfos[i][INDEX_ID];
duplicates.push([currentRecordId, recordDescription, recordDuplicateInClusterCount, "Person_entity"]);
recordClusterId = currentClusterId
recordDescription = currentDescription
recordDuplicateInClusterCount = 1;
}
}
}
else if(targetEntity == "Organisation_entity")
{
......
......@@ -11,6 +11,9 @@
<tableViewTemplate>
<name>PersonDuplicatesTable</name>
<entityField>#ENTITY</entityField>
<isCreatable v="false" />
<isEditable v="false" />
<isDeletable v="false" />
<columns>
<neonTableColumn>
<name>7508e984-6a0b-4126-ab49-452e2b54f76d</name>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment