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
sangam vvsangam vv 

Friends I stuck in one more Requirement Query?

Here I have one Account (standard) object and Opportunity(custom )
Eg:   HP(Account) have 1000 oppotunity 
In VF page I want to see How Many Records Are crewatd In last week ,This week,Last month,This month  how to display Based On calender wise.
sslodhi87sslodhi87
Hi Umesh,

You need to query the records on the basis of this week, last week, this month and last month seprately.
List<Opportunity> lstOpportunitythisWeek = [SELECT Id, Name FROM Opportunity WHERE CreateDate =: THIS_WEEK];

List<Opportunity> lstOpportunitylastWeek = [SELECT Id, Name FROM Opportunity WHERE CreateDate =: LAST_WEEK]

List<Opportunity> lstOpportunitythisMonth = [SELECT Id, Name FROM Opportunity WHERE CreateDate =: THIS_MONTH]

List<Opportunity> lstOpportunitylastMonth= [SELECT Id, Name FROM Opportunity WHERE CreateDate =: LAST_MONTH]

Please let me know if this works for you.

Thanks

 
Dheeraj Chawla 2Dheeraj Chawla 2
Hi umesh,

you need to write a SOQL query in which you make a Child to parent relationship and apply the filter on CreatedDate field
 for example:

List<opportunity__c> opp=Select id, Name, opportunity__c.Account.Name, opportunity__c.Account.Email from Opportunity__c where CreatedDate=Last_week;


Then use the pageBlockTable tag for displaying the records on VF page.


 
sangam vvsangam vv
Guys  also i want t display in count wise
like thisUser-added image


Channel name is  a account oject then remaing columns are relatd child records this is overall report but i want to display weekly,Monthly.
Dheeraj Chawla 2Dheeraj Chawla 2
Hi umesh,

I think you need to add these fields in your tables, give appropriate data to them and do query on them means add these fields in your query.