Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Coping/Referencing/Cloning list/droplist object values to another list/droplist object

Avatar

Level 2

Hi,

I have a list object (list1) that is empty and another list that have over 1,000 items (list2).

How I can copy the values in list2 to list1 without looping through list2 items? Is there a reference assignment? For example; you can copy the image value of one image object to another image object by using the following assignment:

    ImageField1.rawValue = Image1.value.image.value;

I tried the following for the list but did not work :

list1.rawValue = lsit2.rawValue;

lsit1.value = list2.value;

list1.items = list2.items;

Really appreciate your help,

BR,

Yasser

5 Replies

Avatar

Level 10

Hi Yasser,

As I understand it you can List1 to display the selected item in List2. Is that correct?

If that is the case, then List1 does not need to be a list object, as it will only be displaying a single value. Here you could use a TextField object, with the following in the calculate event:

this.rawValue = List2.rawValue;

If you want List1 to have the same 1,000 items as List2, then you would either set up the list object at design time in LC Designer OR loop through List2 at runtime.

Here are some dropdown examples:

Hope that helps,

Niall

Avatar

Level 2

Hi Naill,

Thank for your reply.

The second case is what I'm looking for... I'll visit the links you suggested an get back to you if I have any challanges.

Thanks again,

BR,

Yasser

Avatar

Level 10

Something like this in the preOpen event of List1:

for (var i=0; i<List2.length; i++) {

     this.addItem(List2.getDisplayItem(i));

}

Hope that helps,

Niall

Avatar

Level 2

Thanks Nail,

Yes this will work perfectly if the list of items are minimal, but if you have 1,000's of line items (such product SKU's) then, this will be over killing, especially if you have this DD in a repeatable sub-forms (kind of BoQ). This will be a huge overhead both in size and perfromance...

I'm still researching a kind of "in-memory" or "pointer" referencing of values in DD...I hope someone from Adobe product development team can shade a light on a "non-documented" method.

BR,

Yasser

Avatar

Level 10

Hi Yasser,

I had forgotten John Brinkman's post on setItems(), http://blogs.adobe.com/formfeed/2009/01/populating_list_boxes.html.

This will work if your users are using Acrobat/Reader version 9 or above.

Good luck,

Niall