I have a multiline text column with many 9 digit numbers delimitated by commas that i would like to extract so I can check for duplicates. If I can check for duplicates without extracting that would be even more helpful.

1 Answer 1

//get Values of multiline field in variable
var text=SPUtility.GetSPField('Description').GetValue();
//Multiline textbox has html elements, trimming them
//converting each comma separated 9 digit number into array
var array=text.split(',');
//function to check duplicates in array. True if elements of array is unique else false
function checkIfArrayIsUnique(myArray)
for (var i = 0; i < myArray.length; i++)
if(myArray.indexOf(myArray[i]) !== myArray.lastIndexOf(myArray[i]))
return true;} 
return false;   // this means not unique
//flag will be false if non unique numbers in multiline textbox
var flag=checkIfArrayIsUnique(array);
  • I assume this requires some form of programming above and beyond sharepoint designer?
    – Jim
    Nov 16, 2015 at 15:13
  • You can Add Above script in Script Editor on the new item and edit item page Nov 17, 2015 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.