Workaround for when Notes does not allow commas in lists

This tip describes a workaround for when Notes does not allow commas in lists.

Sometimes Notes' imperfections go beyond the annoying and become real problems. For example, you can't show values with embedded commas in a ListBox for a user to select from. When you want to present a list of customer names, this is a real roadblock, as company names with the formats "ABC, INC." and "SMITH, SMITH, & JONES" are very common. As I tried to come up with a workaround, I found the following helpful hint on Notes.Net

Armed with this information, here's how I implemented a solution to this issue:

Sub CommaSubstitute(array As Variant, 
action As String, changed As Integer)

When values with embedded commas 
appear in a listbox for selection, the 
comma acts as a value  separator, 
although this is not desired. There is 
no way to disable this. So this routine
 is needed to "tweak" existing commas 
so they don't act this way.

We replace all commas with 
high-order-bit (HOB) commas, which 
look identical to the user,  but Notes does 
not recognize them as a value separator. 
We can also do the reverse,  replacing any
 HOB commas with its original ones.

This sub replaces ALL commas, even 
multiple ones in the same piece of text.

Important! Any time an array is "tweaked" 
so the user can select from it, it should 
be  "untweaked" afterwards! For example, 
if you forget to do this, and you try to use the 
selected value as a key to retrieve a document, 
the document will never be found.  You can use 
the returned value of "changed" to see if this 
step is necessary: if True,  the array was changed, 
so you will have to "untweak" it; if False, you can 
skip this step.


ARRAY = the input array, which will be reviewed 
and changed by this sub.
ACTION = "TWEAK" or "UNTWEAK" = should we 
replace the commas with HOB commas, or  
back out any such existing replacements?
CHANGED = a True/False flag. If False, 
nothing was changed; if True, at least  one value was changed.
%END REM changed = False Dim SearchValue As String, ReplacementValue As String Dim x As Integer, i As Integer, L As Integer If action = "TWEAK" Then SearchValue = "," ReplacementValue = Chr(0130) Elseif action = "UNTWEAK" Then SearchValue = Chr(0130) ReplacementValue = "," Else Messagebox "CommaSubstitute called with invalid argument = " & action & " Please contact Support.", 48, "System Error" Exit Sub End If Forall valu In array L = Len(valu) For i = 1 To L If Mid(valu, i, 1) = SearchValue Then Mid(valu, i, 1) = ReplacementValue changed = True End If Next End Forall End Sub

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...