Combine lists using script and make it unique

I have 2 fields in the currently open document values of which i need to combine and make the new list unique. How do I do that?

Subject: Combine lists using script and make it unique

assuming each field is multivalue:

Create an array out of each field’s values.

Use ArrayAppend to combine them into a new combined array.

Use ArrayUnique to remove any duplicate values.

Subject: RE: Combine lists using script and make it unique

Hi,

Jessie is correct…

You can do that by using ArrayAppend and ArrayUnique…

According to my understanding you have two multi-value fields and you want to combine the values of both and make a new list.

Consider you have FieldA and FieldB

Your code would look like this

Dim varFieldA as variant

Dim varFieldB as variant

Dim varCombinedValue as variant

varCombinedValue =ArrayAppend(varFieldA,varFieldB)

varCombinedValue =ArrayUnique(varCombinedValue )

'—if the value needs to be set in a new field then u can use

call doc.ReplaceItemValue(fieldname,varCombinedValue)

HTH,

Thish.