You need to sign in to do that
Don't have an account?
Aniche
Accessing Arrays
I have created an array which stores 1 row of data from the SOQL that i executed.
The code is
Lead[] lead1 = [Select l.AnnualRevenue, l.Name from Lead l where l.OwnerId = 'whatever' and l.AnnualRevenue > 540000000];
system.debug(Second field is '+lead1[1]);
This gives and error saying "List index out of bounds"
Since i have 2 fields that i have pulled in the query i have put 1 in the index.
Can somebody help me to understand my problem,
If someone has array examples storing single resultset and multi result set the it would be helpful.
Thanks
Aniche
Oops.... I learnt this - Since the resultset has only 1 record and is giving Out of bounds error so basically what my array[1] is trying to do is access second record in the array.
Now my question is how to access individual columns in the array ?
Hopefully i get this one too but will surely appreciate any replies.. Thanks.
Superfell
lead1[0].name
Aniche
Thanks.. That was easy.. Appreciate that