logic to check if two replicants item has duplicated values onSave event: var len = [Get the length of the replicant]; for (var i = 0; i < (len - 1); i++) { var item1 = [Fetch the Item's value in the replicant you want to compare with]; if (item1! = "") { for (var j = (i + 1); j < len; j++) { var item2 = [Fetch the Item's value in the replicant you want to compare against]; if (item1 == item2) { //We have some duplicated values...give an alert and return false } } } } Hope this helps!!Archie
var len = [Get the length of the replicant]; for (var i = 0; i < (len - 1); i++) { var item1 = [Fetch the Item's value in the replicant you want to compare with]; if (item1! = "") { for (var j = (i + 1); j < len; j++) { var item2 = [Fetch the Item's value in the replicant you want to compare against]; if (item1 == item2) { //We have some duplicated values...give an alert and return false } } } }
function checkValues() { var item = IWDatacapture.getItem(/* replicant xpath */); var len = /* Get the length of the replicant */;var hash = new Object; var msg = ''; for (var i = 0; i < len; i++) { var val = /* replicant instance's value */;if (val in hash) { msg += "Value '"+val + "' is duplicated.\n"; /* mark replicant instance value as invalid */; } else { hash[val] = 1; } } if (msg != '') { alert(msg); return false; } return true;}