How to remove an item from the list?

Hi …

I want to remove a item from the list? I am actually checking for the particular item in the list, then that item has to be removed from the list?

I can see whether there the list contains that perticular item or not? but after that i am not able to remove the item.

How to achieve this?

Thanks.

Hima

Subject: How to remove an item from the list ?

This code removes one or several items from a list (with sort, for web
presentation)
listAll := ;
eliminate := ;
list_red := @Unique(@Replace( “” : listAll; eliminate ; “”)) ;
num :=@Elements(list_red) - 1;
newNames := @Subset(list_red; -(@Elements(list_red) - 1));
@Implode(@Sort( newNames); “br>]”)

Subject: RE: How to remove an item from the list ?

Hi Eva …thanks alot for the quick response … but i need the help for LS.

Subject: How to remove an item from the list ?

You are not stating if You are interested in a @Formula -solution or LotusScript solution…

Well, Here is a LS:

Dim vMembers As Variant

If Not (IsNull(Arraygetindex(doc.FieldName,“SearchFor”,5))) Then

’ It is a member in the list!

vMembers = doc.FieldName

’ Remove the member:

vMembers(Arraygetindex(vMembers,“SearchFor”,5)) = “”

’ Store back into the field:

doc.FieldName = vMembers

call doc.Save(True,false)

End If

If it is formula, use Eva’s answer…

Subject: RE: How to remove an item from the list ?

Hi Kenneth …I am sorry for not mentioning it is for LS or @Formula

it is for LS solution …

Thanks alot for the quick response …

Please have a look at the code that i wrote …

Dim session As New NotesSession

Dim col As NotesDocumentCollection

Dim doc As NotesDocument

Dim test As String

Dim db As NotesDatabase

Dim mailDoc As NotesDocument

Dim rtItem As NotesRichTextItem

Dim amexDoc As NotesDocument

Dim AmexView As NotesView

Dim originalDoc As notesdocument

Dim rtpStyle As NotesRichTextParagraphStyle

Dim viewRegNoLookup As NotesView

Dim viewRegNoTA As NotesView

Dim requestCol As NotesDocumentCollection

Dim doc1 As NotesDocument

Dim RegNoDoc As NotesDocument

Dim i,j,m,x As Integer

Dim TravelAssistant As NotesName 

Dim blankArray(0) As String

Dim historyArray As Variant



blankArray(0) = ""

historyArray = blankArray



Set db = session.CurrentDatabase

Set col = session.CurrentDatabase.UnprocessedDocuments

Set doc = col.GetFirstDocument

Set TravelAssistant = New NotesName( doc.GetItemValue( FLD_PROFILE_PROFILEUSER )(0) )

Set viewRegNoLookup = session.CurrentDatabase.GetView(VIEW_LOOKUP_CUSTOMERNOBY_TA)

Set requestCol = viewRegNoLookup.GetAllDocumentsByKey( TravelAssistant.Abbreviated, True )

Set doc1 = requestCol.GetFirstDocument

Msgbox requestCol.Count

historyArray = doc1.GetItemValue (FLD_CUSTOMERNO_TRAVELASSISTANT)

Msgbox Ubound(historyArray),“historyArray”

While Not doc1 Is Nothing

For i=0 To 0

historyArray = doc1.GetItemValue (FLD_CUSTOMERNO_TRAVELASSISTANT)

Msgbox i,“i”

Forall k In historyArray

If ( k =TravelAssistant.Abbreviated) Then

Msgbox "Present"

(Actually here i have to remove the item if k =TravelAssistant.Abbreviated, but i am not able to acheive it)

End If

End Forall

Next

Please tell me where i am doing wrong

Subject: RE: How to remove an item from the list ?

You don’t have to loop through the array nor the fieldvalues when using Arraygetindex. Just do like this:

Dim vMembers As Variant

Set doc1 = requestCol.Getfirstdocument()

If Not IsNull(Arraygetindex(doc1.GetItemValue(FLD_CUSTOMERNO_TRAVELASSISTANT),TravelAssistant.Abbreviated,5)) Then

vMembers = doc1.GetItemValue(FLD_CUSTOMERNO_TRAVELASSISTANT)

vMembers(Arraygetindex(doc1.GetItemValue(FLD_CUSTOMERNO_TRAVELASSISTANT),TravelAssistant.Abbreviated,5)) = “”

call doc1.ReplaceItemValue(FLD_CUSTOMERNO_TRAVELASSISTANT,FulltrimvMembers))

This is just out of my head - not tested, but it should get You going in the right direction.

hth

Subject: How to remove an item from the list ? Worked :slight_smile:

Hi Kenneth…

Thanks alot … it worked…

u r my saviour …

Hima

Subject: RE: How to remove an item from the list ?

Hi Kenneth…

vMembers(Arraygetindex(vMembers,“SearchFor”,5)) = “”

It doesnt work…

Actually i am getting a collection of documents based on a key and the key is the item … and after that i am trying to remove only the matching items in those documents…

But this item is a dialog box… i am trying to remove an item fron the multivalued item…

Please please help