Delete Empty value in Array

Hello All and Happy New Year.

I am trying to delete an ampty space from array. For example:

Manager1 BlaBla1

Manager2 BlaBla2

“”

Manager4 BlaBla4

“”

Manager6 BlaBla6

Can someone review my code and let me know what is wrong with it.

Dim arrValue() As String

Forall aux In CurrentDoc.GetPair

Redim Preserve arrValue(n)

If aux <> “” Then

arrValue(n) = CurrentDoc.GetPair(n)

'Erase arrValue(n)

End If

n=n+1

End Forall

CurrentDoc.GetPair = arrValue

Call CurrentDoc.save(False,False)

Thank you for your help.

-vadim

Subject: Delete Empty value in Array

Brandt may be right about lists, but to correct your code, you just need to make sure you’re only redimming and incrementing n if there is a value - move those two lines inside the if aux<>“” section and it should work fine.

Dan

Subject: RE: Delete Empty value in Array

Thank you guys. Problem is solved.

Subject: Delete Empty value in Array

Are you getting an error? or is it behaving in a way you weren’t expecting?

I would not use forall here. I would consider using a List variable instead. It has built in functions for adding and removing values.

You can use the Manager# as your key and put the string value as the value.

This would be especially useful if the undefined Manager values are null but still have the manager# available as the key.

Look in the Notes help under lists…

Brandt

Subject: RE: Delete Empty value in Array

Thank you Brandt,

I don’t have any errors in my code. It just doesn’t remove an empty quotes. Can you please give me an example of of your code?

Thank you,

v