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
plapla 

SQOL return result

Hello,

Is there a way to find out if the below SQOL statement return a result? Another word if aName returns nothing, is there a statement to tell me the return results? Please advise.

 

Account aName = [SELECT id, name, Type FROM Account WHERE Group_Number__c =: GroupNo and Type =: 'Client' and RecordTypeId =: '01230000000XhdNAAS' limit 1];

 

Thanks

Paul

 

Saikishore Reddy AengareddySaikishore Reddy Aengareddy

List<Account> aName = new List<Account>();

aName = [SELECT id, name, Type FROM Account WHERE Group_Number__c =: GroupNo and Type =: 'Client' and RecordTypeId =: '01230000000XhdNAAS' limit 1];

if(aName.size()==0){

//Meaning no result returned

}else{

//Result returned

system.debug('Returned Result@@@@'+ aName[0]);

}

gbu.varungbu.varun

List<Account> aName = [SELECT id, name, Type FROM Account WHERE Group_Number__c =: GroupNo and Type =: 'Client' and RecordTypeId =: '01230000000XhdNAAS' limit 1];

 

 

if(aName <> null && aName.size()>0){

//Has some result

}else{

//No some result

}

souvik9086souvik9086

if(aName != NULL && aName.size() > 0) {

System.debug('===== Value Returned =====');

}

else{

System.debug('===== No Value Returned =====');

}

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

plapla

Thanks for your help. That's I was looking for.

 

Paul

 

souvik9086souvik9086

If you got your answer and get helped by the answers then please take your little time to mark that as solution and give KUDOS to those, so that other users will be benifitted by that when they will be trapped by same sort of problem.

 

Thanks