LocateAdd

The LocateAdd function will add a value to the dynamic array only if the value being added does not already exist. If the value does exist but has associated subfields the new value will still be added to the end of the list. This function does not interact with SUB and SSUB fields and therefore treats a whole record with subfields as 1 string during the compare.

Group: Dynamic Array Extensions


Syntax: LocateAdd(vVAL, vInfo, [vDLM])

vVAL   (Variant) is the value to be located or added to the Dynamic Array.

vInfo   (Variant) is the dynamic array variable that will be searched.

vDLM  (Variant) Optional – is the delimiter to use when searching.

Example:

Dim sNames As String

sNames = "John#31#Canadian English@UnitedKingdom English&Mike"

LocateAdd("Mike", sNames) ' Since Mike already exists nothing is added

LocateAdd("John", sNames) ' Since John is associated with subfields in the first record, it will again be added to the end of the string:

"John#31#Canadian English@UnitedKingdom English&Mike&John"

LocateAdd("Albert", sNames, "X")

This adds “Albert” to the end of the list and uses the letter ‘X’ to separate the last entry and Albert.