Concatenating 2 list fields using Formula

Hi

I am trying to do 1 of the simplest thig in Lotusscript ( i think), but I cannot manage to do it.

I have 2 list field. Both fields have the same numbers of items. I want to concatenate these 2 fields into a third field like this:

item1field1~item1field2

item2field1~item2field2

item3field1~item3field2

item4field1~item4field2

item5field1~item5field2

I tried doing it like this:

Members1 + "~ + Members2

But then it place eachh item from field 2 to each item of field 1.

How should the Formula look like to achieve this?

Regards

Subject: Concatenating 2 list fields using Formula

Dim w As New notesuiworkspace	Dim doc As notesdocument



Set doc = w.CurrentDocument.Document



Dim a1 As Variant

Dim a2 As Variant

Dim a3 As Variant



a1 = doc.GetItemValue("a1")

a2 = doc.GetItemValue("a2")

a3 = Evaluate("a1+'~'+a2", doc)



Call doc.ReplaceItemValue("a3", a3)

hope it will help u

dmytro.

Subject: Concatenating 2 list fields

slightly confused by your question so some clarification first

(BTW: it seems to me you are using the word ‘FORMULA’ to mean the generic term ‘lines of programming’ rather than its specific one in Lotus Domino of the programming facility FORMULA rather than LOTUSSCRIPT… I apologise if I’m wrong here)

Well back to basics::

Fundamentally You have a document with 2 items (members1 Members2)

both text, multiple value - with the same number of elements)

Lets say Members1 is “A” : “B” : “C”

and Members2 is “x” : “y” : “z”

You wish to create a third item (lets say named Members2) and give it a value

“A~x” : “B~y” : “C~z”

Is that correct ?

IF No please clarify.

If YES then doing this in FORMULA is easy using as you say Members1 + “~” + Members2

since the Formula operator “+” acts what is called pairwise on multiple values

(You might put this in a formula agent as

FIELD Members3 := Members1 + “~” + Members2 ;

)

However you seem to have mentioned LOTUSCRIPT where teh simple + operator is NOT pairwise.

You could write a loop in LS to deal with this … however if the two items are on the same document why not take advantage of the FORMULA dialect by

Dim v as Variant

v = Evaluate( { Members1 + “~” + Members2 } , doc )

v is now a multiple value as you want e.g.

doc.Members3 = v