Hi, i have a DB with a Names Field that allows multiple Usernames.
What i try to do is:
-
Click a button
-
My Username is removed on the Names-Field
-
My Username is entered in another Names-Field (multi values)
How can i add or remove Names in the Names-Field Array without loosing the other Usernames?
Thanks in advance for any help.
Volkan Senguel
Subject: Add/Remove User from Names field with a button
You don’t mention whether you’re trying to do this in LotusScript or Formula language. I’ll assume LotusScript.
The NotesItem AppendToTextList method should cover your requirements to add a username to a multi value field.
There are two ways to remove a value from a field; the first involves looping through each entry in the field, building a new array as you go, and when you find the entry to remove, skip it from the new array. Then write the new array values back to the field.
Alternatively (and possibly more efficiently), you can assign the value of the multi value field to a variant, and then use the ArrayGetIndex method to find the name you want to remove. The use the ArrayReplace method to set the entry to a null value (i.e. “”) and finally, FullTrim the array to remove empty entries before writing it back to the field again. I haven’t provided code because it’s much more valuable if you learn how to do this yourself.
HTH
Subject: RE: Add/Remove User from Names field with a button
Thanks giles i will try this 