You need to sign in to do that
Don't have an account?
Bharat.Sharma
Stuck in SOQL query in Lead Object
Hello all,
Thanks in advance,
I am trying to fetch some records in object LEAD. but i am stuck, please Help me to Out of there.
Lead object have a standerd field LastActivityDate, In some leads it is blank and some times it is filled with a specific date. so i want Count the leads that contains value (Date) in their LastActivityDate(Field) and count too who doesn't have value of LastActivityDate(field) means (LastActivityDate = null) .i want these two record in one table.
I have already impliment that scenario, But
i have two query first one is returning null values :
Secoend one is returning not null values:
Acctully i am creating dashboard in VF page thats why i need a query who calculate the LastActivityDate null and not null values and show them in a pie chart so please use GROUP BY LastActivityDate .
Thanks and Regards
Bharat Sharma
Thanks in advance,
I am trying to fetch some records in object LEAD. but i am stuck, please Help me to Out of there.
Lead object have a standerd field LastActivityDate, In some leads it is blank and some times it is filled with a specific date. so i want Count the leads that contains value (Date) in their LastActivityDate(Field) and count too who doesn't have value of LastActivityDate(field) means (LastActivityDate = null) .i want these two record in one table.
I have already impliment that scenario, But
i have two query first one is returning null values :
SELECT COUNT(id) FROM Lead WHERE LastActivityDate = Null
Secoend one is returning not null values:
SELECT COUNT(id) FROM Lead WHERE LastActivityDate != Null
Acctully i am creating dashboard in VF page thats why i need a query who calculate the LastActivityDate null and not null values and show them in a pie chart so please use GROUP BY LastActivityDate .
Thanks and Regards
Bharat Sharma
I think that you are not using the correct return type for the query that you have written. If you want to use Count(Id), then you should use the following query ->
AggregateResult[] groupedResults = [SELECT Count(Id)idc FROM Lead WHERE LastActivityDate = Null];
Object countid = groupedResults[0].get('idc');
Where 'countid' will return the number of Leads where the value of 'LastActivityDate' field is null.
And if you want an Integer return type, then use this simple query ->
Integer j = [SELECT Count() FROM Lead WHERE LastActivityDate != Null];
Where 'j' will return the number of Leads where the value of 'LastActivityDate' is not null;
Regards,
Ajay