(NEVER MIND, I Have the answer) This probably asking a lot from Lotus Notes but . .

NEVER MIND I just found my answer, I was making it more complicated than it had to be. . . .

. . . Is there LotusScript, JavaScript, or Formula language that can compare 2 multi-value fields and determine which values in mutli-value field 1 are not in multi-value field 2?

So Fld 1 contains 1,2,3,4 and Fld 2 contains 1,3

Can I have code in a third fld that computes to just those values missing from Fld 2?

In this case, Fld 3 would contain 2,4

Thanks,

Chad

Subject: (NEVER MIND, I Have the answer) This probably asking a lot from Lotus Notes but . . .

Even if you think it was easy, you could help the forum and post you code,

thank you,

JYR

Subject: RE: (NEVER MIND, I Have the answer) This probably asking a lot from Lotus Notes but . . .

Here is my code. . .

I have a large # of “Notify” fields that can contain multiple user names. I need to determine who out of all my Notify fields has not opened the document and approved/rejected the proposal. Every 5 days an agent runs to send an email to those people who have not approved/rejected the proposal.

This code looks at all my Notify fields and fills “Who_Is_Left” with everyone who has yet to approve/reject the proposal.

So in the QuerySave of the form I have this code:

Set Item = doc.GetFirstItem(“RFI_Signer”)

Set Item3 = doc.GetFirstItem(“Who_Is_Left”)

Call doc.ReplaceItemValue(“Who_Is_Left” , “”)

Forall value In Doc.Notify_EE

If Item.Contains(value) = False Then

Call Item3.AppendToTextList(value)

End If

'Check all other Notify fields with the ForAll loop like above

.

.

.

Call doc.ReplaceItemValue(“Who_Is_Left” , Item3)

Call doc.Save(True,True)

It may not be the cleanest or prettiest, but it works for what I need it to do.

Subject: RE: (NEVER MIND, I Have the answer) This probably asking a lot from Lotus Notes but . . .

Paul has a simple answer for you as a field formula. If you want to do it in QuerySave with lotus script, this may also be used.

You can also use Arrayreplace function of lotus script.

ArrayReplace( sourceArray, compareArray, replaceArray )


dim var1 as variant

dim var2 as variant

dim var3 as variant

dim ans as variant

var1 = Source.Document.Field1

var2 = Source.Document.Field2

for i = 0 to Ubound(var2)

if i = 0 then redim var3(i)

if i > 0 then redim preserve var3(i)

var3(i) = “”

Next

ans = FullTrim(ArrayReplace(var1, var2, var3))

If var1 contains 1,2,3,4,5

If var2 contains 1,4

var3 contains “”,“”

Finally the result will be ------> ans = 2,3,5

Subject: (NEVER MIND, I Have the answer) This probably asking a lot from Lotus Notes but . . .

Computed value for field3

@Trim(@Replace(field1; field2; “”))