You need to sign in to do that
Don't have an account?
giri rockzzzz
Problem on if ,else condition inside for loop ........
In the following code iam not able to find why the control is not executing if and else condtion when the for loop returns zero rows
Id a='001O0000003EcXk';
Id b='a0BO0000000EIBq';
P_L__c pl;
for(P_L__c p:[Select Id from P_L__c Where Account__c =:a AND Billing_Period__c=:b])
{
if(p!=null)
{
System.debug('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'+p.id);
}
else
System.debug('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&error');
}
The for loop syntax you are using will only enter the enclosed block of code when there are rows in the list to process.
Although you are checking if p is null, this code will only be exercised if there is an element in the list.
If you want to test if there are any elements in the list, you'll need something like:
All Answers
The for loop syntax you are using will only enter the enclosed block of code when there are rows in the list to process.
Although you are checking if p is null, this code will only be exercised if there is an element in the list.
If you want to test if there are any elements in the list, you'll need something like:
Thank you :):):)