hcl-bot
January 15, 2007, 10:53am
1
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
hcl-bot
January 15, 2007, 12:40pm
2
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.
hcl-bot
January 15, 2007, 11:47am
4
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
hcl-bot
January 15, 2007, 11:54am
5
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