Value from multi text field

I have text field with i can set some values, f.g.:

val1;val2;val3;val4

Now I can get each value and add to value string “-aaa”. Reasult:

I want to get:

val1-aaa;val2-aaa;val3-aaa;val4-aaa

How can I get each value in Lotus Script from text field with some values?

Subject: Value from multi text field

Formula is actually better for this job but there are a couple of ways to do it with script, here is one:

dim doc as notesdocument

dim item as notesitem

dim newvals() as string
dim i as integer

set doc = uidoc.document ’ doesn’t matter if it has been saved yet as long as it’s PostOpen or later

set item = doc.getfirsitem(“multivaluefield”)

redim newvals(ubound(item.values)) as string

for i = 0 to ubound( newvals )

newvals(i) = item.values(i)+“-aaa”

next i

call doc.replaceitemvalue(item.name, newvals)

call uidoc.refresh ’ optional, in case field is hidden

You could also use .fieldsettext() but that requires a lot more fooling around with strings. Going right to the back end - as in this example - is cleaner and simpler. But if you have other, unsaved field values they might get unloaded when you do a replaceitemvalue so watch out for that. Refresh the form before doing the replaceitemvalue; this makes sure that the other, unsaved field values are also visible to the back end.

Subject: Value from multi text field

“How can I get each value in Lotus Script from text field with some values?”

It sounds like you are simply asking how to access the data in multi-value items from LotusScript?

You access the array of item values using doc.itemname, and then you loop through the doc.itemname array, typically using Forall, but you can also use For i = 0 to Ubound(doc.itemname).

Was that your question?

Subject: Value from multi text field

Use the Join function (if this is R6).

Otherwise can use formula language in a computed field thus:

multifield + “-aaaa”

would give you the result you wanted as “-aaaa” would be added to each element of the list

Subject: RE: Value from multi text field

Problem is I have to get each element in Lotus script. Value from this field have to been keys.

Subject: Value from multi text field

Assuming that field “fieldname” has the values val1;val2;val3;val4 you can

Forall v in doc.FieldName

Print v & “-aaa”

End Forall

cheers!!

Ashish