Skip to Main Content
Categories Form controls
Created by Guest
Created on Sep 19, 2023

De-duplicate list lookup results

On a Nintex Workflow start form, using a list lookup control with a filter often results in duplicate values being displayed.

May I propose a small addition to NF.BaseDataAcessHelper.js in the updateControl function.

// added at NintexForms\NF.BaseDataAcessHelper.js line 625 of v4.6.6

if(items.split(';').length > 1){

var arr = items.split(';')

const hashTable = {};

const result = [];

for (let i = 0; i < arr.length/2; i+=2) {

if (!hashTable[arr[i+1]]) {

hashTable[arr[i+1]] = true;

result.push(arr[i],arr[i+1]);

}

}

items = result.join(';');

}


  • Attach files
  • Guest
    Reply
    |
    Sep 19, 2023

    Oops, Corrected!


    if(items.split(';').length > 2){
    var arr = items.split(';')
    const hashTable = {};
    const result = [];
    for (let i = 0; i < arr.length; i+=2) {
    if (!hashTable[arr[i+1]]) {
    hashTable[arr[i+1]] = true;
    result.push(arr[i],arr[i+1]);
    }
    }
    items = result.join(';');
    }