You need to sign in to do that
Don't have an account?
Abhishek Pal 33
How to use subquery in reports in salesforce?
I have a query which I am using in workbench which includes a subquery in it. Now I want to generate a report with similar query.
Can you please help?
Thanks in advance.
NOTE: Its in reports application in salesforce.
Can you please help?
Thanks in advance.
NOTE: Its in reports application in salesforce.
I've used it for accounts and contact, you can refer to the following code:
Here is the page-
<apex:page controller="RetriveAcctable">
<apex:sectionheader title="Account" subtitle="All Account"/>
<apex:pageblock >
<apex:pageblocktable value="{!acc}" var="key">
<apex:column value="{!key.name}"/>
<apex:column value="{!key.AccountNumber}"/>
<apex:column value="{!key.Industry}"/>
<apex:column >
<apex:facet name="header">Contacts</apex:facet>
<apex:pageblocktable value="{!key.Contacts}" var="keyc">
<apex:column value="{!keyc.name}"/>
</apex:pageblocktable>
</apex:column>
<apex:column value="{!key.phone}"/>
</apex:pageblocktable>
</apex:pageblock>
</apex:page>
Here is the controller-
public with sharing class RetriveAcctable {
public list<account> getacc(){
list<account> li = [select Name,AccountNumber,Industry,(select name from Contacts),phone from account];
if(li!=null && !li.isEmpty()){
return li;
}else{
return new list<account>();
}
}
}
Thanks
Regards
Thanks for your help. The code that you have mentioned above is one way but cant we use the reports feature of salesforce to do the same thing that you have done above.
I mean I am able to filter out the condition within table (Account) and cross filter(Cycle) but the thing where I am stuck in reports is I am using a condition Id(Account) NOT IN(select Id(Account) from cycle).
The highlighted part of subquery where I want account ID of all accounts which are not in this cycle. This I am not able to do in reports.
I didnt have much idea about reports and dashboards in salesforce so If you know something about this please help.
Thanks
-Abhishek