You need to sign in to do that
Don't have an account?
pla
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
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]);
}
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
}
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
Thanks for your help. That's I was looking for.
Paul
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