Move values from multivalue fields using Arrays

Hello,

I have 6 multivalue fields. Product A, Product B, Sale A, Sale B, Volume A, Volume B.

Product A, Product B are Text and other fields are numbers.

I want to move the values from one Product to other Product.

Ex:

Product A --Product B–Sale A-----Sale B—Volume A—Volume B

Laptop ----Keyboard—10000.00—500.00—10---------12

Desktop-----Mouse------5000.00----400.00—10---------15

Handhelds—Monitors—4000.00----1000.00–20---------5

Blackberry–Router-----2000.00----1000.00–5----------8

I want to move Monitors (Product B), 1000.00 (Sale B) and 5 (Volume B) to

Product A, Sale A and Volume A.

This is through a scheduled agent on all documents using Lotus script. I know I have to use the arrays but don’t know how to write the code. I am not much familiar with Arrays.

I can get all documents from a view but not getting idea on how to remove the values from B and move it to A? I am stuck and don’t know how to proceed further.

Can someone give me an example on solving this?

Thanks

sri

Subject: Move values from multivalue fields using Arrays

I think you’ve got a fear or arrays that shouldn’t exist.

Should the values of the Product B be blank after?

Can we safely assume that all multiple value fields are the same size?

Dim x as Integer

For x=0 to ubound( doc.ProductB )

if UCase(doc.ProductB(x)) = "MONITOR" then

	doc.ProductA(x) = doc.ProductB(x)

	doc.SalesA(x) = doc.SalesB(x)

	doc.VolumeA(x) = doc.VolumeB(x)

	doc.ProductB(x) = "Blank"

	doc.SalesB(x) = 0

	doc.VolumeB(x) = 0

End If

Next

Subject: RE: Move values from multivalue fields using Arrays

Hi Stephen,

Sorry for the previous posting. The values are not the same size. Product A could be 30 and B could be 20.

Once its moved from B the row should be removed.

Thanks

sri

Subject: RE: Move values from multivalue fields using Arrays

How are Product A and B associated??

If you start with

Product A

Sales A

Quanity A

Product B

Sales B

Quanity B

1

Cat

10

5

Bird

15

1

2

Dog

20

4

Rabbit

25

2

3

Fish

30

3

Snake

35

3

And then Rabbit goes to Dog and Product B move up?

Product A

Sales A

Quanity A

Product B

Sales B

Quanity B

1

Cat

10

5

Bird

15

1

2

Rabbit

25

2

Snake

35

3

3

Fish

30

3

Was there an association between Dog and Rabbit?

Should the association between Fish and Snake been preserved? If so… Then Product B should not be trimmed?

I’m confused.

Subject: RE: Move values from multivalue fields using Arrays

Hi Stephen,

The products are in a Master list. I am comparing the existing documents with the master list. If Rabbit is Product A in the Master list and is in Prodcut B in the existing document, then I want to move Rabbit and all the related values to A and remove the entry from B.

I don’t want to replace any values from Prodcut A, like Dog with Rabbit. I want to add the Rabbit to Product A .

Thanks

sri

Subject: RE: Move values from multivalue fields using Arrays

Thanks Stephen.

The values of the product B should be empty once its moved to A. All the multivalue fields are the same size. I am not good at arrays and tried couple of ways but diddn’t worked.

Thanks

sri