function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
raju p 4raju p 4 

Agreegate trigger>>summry i am geting this >>error unexpected syntax: 'mismatched input 'for' expecting RCURLY'

public class AgregateFunctionOnTestObject {
    public static void Afterupdate(Map<id,Test123__c> newmap,Map<id,Test123__c>oldmap){
           list<id> ids= new list<id>();
        for(id key: oldmap.keyset()){
            Test123__c n1=newmap.get(key);
            Test123__c o1=oldmap.get(key);
             ids.add(key);
        }
    }
            list<Test__c> tc= new list<Test__c>();
    list<Test__c> t=[select Percentage__c,(select id from Test123s__r)from Test__c where id=:ids];
        for(Test__c t1:t){
            for(Test123__c r:Test123s__r){
            t1.Percentage__c= t1.Test123s__r.size();
            tc.add(t1);
        }        }  
}
        
    
         

 
Vivian Charlie 1208Vivian Charlie 1208

Hi Raju,

 

I believe you need to make few ammendments to the code. Please see the updated code

public class AgregateFunctionOnTestObject {
    public static void Afterupdate(Map<id,Test123__c> newmap,Map<id,Test123__c>oldmap){
           list<id> ids= new list<id>();
        for(id key: oldmap.keyset()){
            Test123__c n1=newmap.get(key);
            Test123__c o1=oldmap.get(key);
             ids.add(key);
        }
    }
            list<Test__c> tc= new list<Test__c>();
    list<Test__c> t = [select Percentage__c,(select id from Test123s__r)from Test__c where id IN:ids];
        for(Test__c t1 : t){
            t1.Percentage__c= t1.Test123s__r.size();
            tc.add(t1);
        }   
}


Thanks

Vivian

raju p 4raju p 4
Thanks for quick replay trigger Agregate on Student__c(after insert,after Delete,after undelete) { set ids= new set(); if(trigger.isinsert || trigger.isUndelete){ for(Student__c s:trigger.new){ } } if(trigger.isDelete){ for(Student__c s:trigger.old){ ids.add(s.Course__c); } } list x= new list(); list cors=[select NUmberOf_Student__c,(select Course__c from Students__r)from Course__c where id In:ids]; // cors.NUmberOf_Student__c=cors.Students__r.size(); // x.add(cors); } /* try{ update x; } Catch(Exception e){ System.debug('Exception :'+e.getMessage()); }*/ i marked green students__r variable not exist how can i use that one please help me out
raju p 4raju p 4
[image: Inline image 1] when aim trying to use student it showing error, please help me out
raju p 4raju p 4
Hi Vivian,
list<course__c> cors=[select name, NUmberOf_Student__c,(select id,Course__c from Students__r)from course__c where id in:ids ];
 
       // cors.NUmberOf_Student__c=cors.Students__r.size(); 
  i want to use last commeted line how can i use  it showing Variable does not exist: Students__r, how can  i resolve this
   
Vivian Charlie 1208Vivian Charlie 1208

Hi Raju,
 

cors is the parent list of Courses

Students__r is the inner list of Stidents for every individual parent (i.e Course)

Inorder to access Students__r it must be used as a variable of every parent object

for(Course__c objC : cors){

objC.Students__r.size();

}


Thanks

Vivian

Vivian Charlie 1208Vivian Charlie 1208

Hi Raju,

 

Any progress with the development?

 

Thanks

Vivian

raju p 4raju p 4
thanks sir. working fine
Vivian Charlie 1208Vivian Charlie 1208

Raju,

 

Please feel free to close this post so that other's can also benefit from this.

 

Thanks

Vivian

raju p 4raju p 4
Thanks
raju p 4raju p 4
Visualforce Error Help for this Page Collection size 10,028 exceeds maximum size of 10,000. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.... public class Leaddisplay { public listld{set;get;} public Leaddisplay(){ // ld= new list(); ld=[select lastname,phone,company,status from lead]; } } On Wed, Apr 19, 2017 at 6:04 PM, raju i wrote: > Thanks >
Vivian Charlie 1208Vivian Charlie 1208

Raju,

Add limit 10000 in the SOQL query. In case you need to display more than 10,000 records then you will need to use pagination.

 

Thanks

Vivian