• Noam Damri 3
  • NEWBIE
  • 25 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
Hey,

So i have this list:
ContactList = [select Id, Name, gender__c , phone, Account.Name, AccountId
                    (select Id,Name,subject__c,level__c                        
                     from custom_object__r)                                                    
                    from Contact];

if im iterating with a for loop on ContactList and reach to the custom_object__r fields, how will i do that?

ive tried this which is not working:
for(Contact TempCon : ContactList)
     TempCon.custom_object__r.Name = 'somthing';

ive tried to iterate the opposite way but it's not working as well:
 for(custom_object__r Temp : ContactList.custom_object__r)  
       Temp.Contact.Name = 'somthing';

Help will be appreciated

Thx!
                    
Hey,

Ive created a two-dimension array and initialized it like that:

        list<list<integer>> two_d_array = new list<list<integer>>();
        integer[] one_d_array = new list<integer>();
       
        for(integer i=0 ; i<d2_size ; i++){
            for(integer j=0 ; j<d1_size ; j++){
                one_d_array.add(0);
            }
            two_d_array.add(one_d_array);
        }
i wanna approach a direct cell like that:
   two_d_array[2][3] = 1289;
    or (do the same thing)
    two_d_array.get(2).set(3, 1289);

The problem is, by doing it it assign all column [3] as 1289.
The array will be like:
[0][3] = 1289
[1][3] = 1289
[2][3] = 1289
etc.

So how can i approach a direct cell. A specific one, not the all column.

Thx a lot!

Hey everybody.

Ive created a 3 dimension integer array, it's go like this:
List<List<List<integer>>> ArrayList = new  List<List<List<integer>>>();

the thing is that i'm trying to approach cell directly, like that:
ArrayList[2][3][4] = 7;

and im getting:
FATAL_ERROR|System.ListException: List index out of bounds: 2

which i was guessing is because i havnt initialized the cell and tried to approach it directly.

ive run a 3 nested for loops in order to initialize the array using:
ArrayList.add(0);
but i kept getting the same message (this time: List index out of bounds: 0, of course)

so im a bit stuck and dont know how to deal with this array but im surely have to use it

suggestions will be welcomed!

Thanks in advanced,
Noam
Hey,

Ive created a two-dimension array and initialized it like that:

        list<list<integer>> two_d_array = new list<list<integer>>();
        integer[] one_d_array = new list<integer>();
       
        for(integer i=0 ; i<d2_size ; i++){
            for(integer j=0 ; j<d1_size ; j++){
                one_d_array.add(0);
            }
            two_d_array.add(one_d_array);
        }
i wanna approach a direct cell like that:
   two_d_array[2][3] = 1289;
    or (do the same thing)
    two_d_array.get(2).set(3, 1289);

The problem is, by doing it it assign all column [3] as 1289.
The array will be like:
[0][3] = 1289
[1][3] = 1289
[2][3] = 1289
etc.

So how can i approach a direct cell. A specific one, not the all column.

Thx a lot!

Hey,

So i have this list:
ContactList = [select Id, Name, gender__c , phone, Account.Name, AccountId
                    (select Id,Name,subject__c,level__c                        
                     from custom_object__r)                                                    
                    from Contact];

if im iterating with a for loop on ContactList and reach to the custom_object__r fields, how will i do that?

ive tried this which is not working:
for(Contact TempCon : ContactList)
     TempCon.custom_object__r.Name = 'somthing';

ive tried to iterate the opposite way but it's not working as well:
 for(custom_object__r Temp : ContactList.custom_object__r)  
       Temp.Contact.Name = 'somthing';

Help will be appreciated

Thx!
                    
Hey,

Ive created a two-dimension array and initialized it like that:

        list<list<integer>> two_d_array = new list<list<integer>>();
        integer[] one_d_array = new list<integer>();
       
        for(integer i=0 ; i<d2_size ; i++){
            for(integer j=0 ; j<d1_size ; j++){
                one_d_array.add(0);
            }
            two_d_array.add(one_d_array);
        }
i wanna approach a direct cell like that:
   two_d_array[2][3] = 1289;
    or (do the same thing)
    two_d_array.get(2).set(3, 1289);

The problem is, by doing it it assign all column [3] as 1289.
The array will be like:
[0][3] = 1289
[1][3] = 1289
[2][3] = 1289
etc.

So how can i approach a direct cell. A specific one, not the all column.

Thx a lot!

Hey everybody.

Ive created a 3 dimension integer array, it's go like this:
List<List<List<integer>>> ArrayList = new  List<List<List<integer>>>();

the thing is that i'm trying to approach cell directly, like that:
ArrayList[2][3][4] = 7;

and im getting:
FATAL_ERROR|System.ListException: List index out of bounds: 2

which i was guessing is because i havnt initialized the cell and tried to approach it directly.

ive run a 3 nested for loops in order to initialize the array using:
ArrayList.add(0);
but i kept getting the same message (this time: List index out of bounds: 0, of course)

so im a bit stuck and dont know how to deal with this array but im surely have to use it

suggestions will be welcomed!

Thanks in advanced,
Noam