List Problem

Hello,

I am facing problem with the list type variable

List1(1)=“A”

List1(1)=“B”

List1(2)=“C”

List1(3)=“D”

Now the problem with as List1 is having 2 same listtag so it is considering only 1 and displaying the final list as

List1(1)=“B”

List1(2)=“C”

List1(3)=“D”

Rather, I am trying for

List1(1)=“A”

List1(1)=“B”

List1(2)=“C”

List1(3)=“D”

Please suggest me regarding this

Thanks

Subject: Try this for example

dim list1 list as variant

dim firstListEntry(1) as variant

dim secondListEntry(1) as variant

firstListEntry(0)=“A”

firstListEntry(1)=“B”

secondListEntry(0)=“A”

secondListEntry(1)=“C”

list1(“1”)=firstListEntry

list1(“2”)=secondListEntry

Subject: List Problem

You can’t - what do you want to get returned if you look at the value of List(1)? You can’t have an array within a list.

You’d need to concatenate the two, with a delimiter which you can then parse. I tend to use the ~

So when setting the values

if iselement(list1(1)) then

list1(1) = list(1) + “~B”

Else

list(1) = “A”

End If

At least that’s what I assume you want to do, you don’t give much info

Subject: RE: List Problem

I have RequestInfo List as Variant

Now RequestInfo contains some information on every listtag.

RequestInfo(RequestNo) = Values

Now I do not know the RequestNo as it is fetched from some other view.

and if RequestNo comes with duplicate entry then it takes one out of 2 request nos.

I want to display both RequestNo.

Thanks

Subject: RE: List Problem

OK, well I just tested this and you can apply a variant array to a list. But you will need to create your array separately. As a simple example:

dim RequestInfo list as variant

dim varray as variant

redim varray(1)

varray(0) = “A”

varray(1) = “B”

RequestInfo(1) = varray

If you reassign a new item to RequestInfo it does write over it (as you’ve found), so you’ll have to do something like the above if you want to use arrays

Subject: RE: List Problem

I do not want to use array.

I have only a list i.e. caseInfo(CaseNo) = CaseDetails

Now if CaseNo is duplicate say

CaseNo = “2131”

CaseNo = “2323”

CaseNo = “2131”

When these case nos. insert in

caseInfo(CaseNo) = CaseDetails

It takes “2131” CaseNo only one time so insipte of displaying the values of

caseInfo(2131) = CaseDetails

caseInfo(2323) = CaseDetails

caseInfo(2131) = CaseDetails,

it is displaying the values of

caseInfo(2323) = CaseDetails

caseInfo(2131) = CaseDetails

Subject: The problem is not the list

The list is working the way it is designed, the problem is you are not understanding how a list works.

You have the example:

List1(1)=“A”

List1(1)=“B”

List1(2)=“C”

List1(3)=“D”

You’re thinking that because you wrote it that way it’s stored that way, it isn’t. When you put you second List1(1)=“B” the original List1(1)=“A” value is gone, finis, none existent.

If you think of it this way I think you’ll realise why what you’re asking for doesn’t work the way you think it should.

Val1 = A

Val1 = B

Val2 = C

Val3 = D

Subject: RE: List Problem

That’s the way it works. I’ve given you a couple of suggestions as to how to get round it, there’s no point in telling me again what you’re doing. If what you’re doing isn’t possible you have to find another way of doing it…