A true @Unique

@Unique is case-sensitive, so "pear" and "Pear" and "PEAR" in a list will remain as three separate values. The formula below will truly return one value "Pear".
Lotus Formula

@Propercase is only applied when a duplicate value exists in the list. Otherwise the formula preserves the exact case of the list. tmpFROM and tmpTO are only applied when the item has been proper cased, as an extra cleanup for words you might not want proper cased.

REM "tmp is your source list that you want to make truly unique";
tmp := @Sort(@Unique("One":"Two":"Three": "Three":"black and white":"Black and White":"pear":"Pear":"Zebra"));

tmpFrom := 	" And " 	: " Or " 	 : " At " 	: " De " 	: " La " 	: " Le "	: " Tv" ;
tmpTo := 	" and " 	: " or " 	 : " at " 	: " de " 	: " la " 	: " le " 	: " TV";
tmpLC := @LowerCase(tmp);
@For(a:=1;a<=@Elements(tmp);a:=a+1;
count:=0;@For(b:=1;b<=@Elements(tmpLC);b:=b+1;@If(@LowerCase(tmp[a])=tmpLC[b];count:=count+1;""));@If(count=1;tmpUnique := tmpUnique : tmp[a];@IsMember(@LowerCase(tmp[a]);@LowerCase(tmpUnique));"";tmpUnique:=tmpUnique:@ReplaceSubstring(@ProperCase(tmp[a]);tmpFrom;tmpTo))
);

@Trim(tmpUnique) ;

Written by fbrefere001

Posted by fbrefere001 on Saturday August 6, 2016