I am trying to use arraygetindex to test whether a value is in an array. If the value is in the array, the index number of its location is returned. In that case, I want to avoid re-adding the item to the array. If it is not in the array, a NULL value is returned to the variant. In that case, I want to add the value as an item in the array (arrayappend). I can't seem to trap the null condition and take the appropriate action.
1] If I test for "vartestItem is null", I get a Type Mismatch at compile time.
2] If I test for "vartestItem = Null" and the value is in the array, it can tell that the variant contains a number and correctly avoids appending the item.
3] If I again test for "vartestItem = Null" and the value is not in the array, the If statement still goes to the Else condition and acts as if the value is in the arrary, even though I can see in the debugger that the Variant contains Null.
Does anyone know how to properly test whether a value is in an array and append if it is not? I have tried converting the variant to string, expecting a "" value if the value is not in the array, but then I get an Invalid Use Of Null error at run time. It looks like I can trap for Error No. 94, but there must be a better way. Can anyone show me the light?