Timeline for Group Records and show on VF Page
Current License: CC BY-SA 4.0
18 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 6, 2019 at 7:38 | comment | added | user61203 | public class RolesFetch { public list<Time__c> projectrole { get; set; } public datetime startdate1; public datetime enddate1; public Time__c a { get; set; } public RolesFetch(){ projectrole=new list< Time__c>(); a=new Time__c(); } public PageReference Fetch() { startdate1=a.From_Date__c; enddate1=a.To_Date__c; projectrole=[select Role__c,SUM(Hourly_Rate__c),Date__c,SUM(Hours__c),SUM(Billable_Dollars__c) from Time__c GROUP BY Role__c,Date__c HAVING Date__c>=:startdate1.date() AND Date__c<=:enddate1.date() ]; return null; } } | |
Mar 6, 2019 at 7:36 | comment | added | user61203 | I have Date__c field on time, so on vf page I want to show two dates, start and end date when user selects dates and click on go button then I want to show time records between those two dates by merging the records which have same role and rate.below is the code I have tried | |
Mar 6, 2019 at 7:34 | comment | added | user61203 | those are the roles I have for now | |
Mar 6, 2019 at 7:32 | comment | added | user61203 | Business Development, Consultant, Senior Consultant, Senior Technical Consultant, Senior Technical Consultant 2, Solution Architect, Solution Architect 2, AMS Manager, Database Administrator, Support – India, Support – North America, Developer – North America, Developer – India, Engagement Manager, Project Coordinator, Project Manager, Technical Consultant – India, Technical Consultant – NA, Technical Consultant – North America 2, Trainer, Shared Services, Admin, Other | |
Mar 6, 2019 at 7:28 | comment | added | Manish Mourya | OK, which type of role you want to add in List Like 1 Admin 2 Developer 3 Consultant 4 Architect etc give complete name of role. | |
Mar 6, 2019 at 7:27 | comment | added | user61203 | Hello Manish, one more thing I need to mention over here is that Role__c is a Formula field, I am fetching the role from another object so its a formula field. | |
Mar 6, 2019 at 7:16 | comment | added | user61203 | Can you please help me out Manish, I am very new to apex so can you? | |
Mar 6, 2019 at 7:14 | comment | added | Manish Mourya | So in That case you have to make List of role. and add complete Roles in role's list and iterate role's List in loop , write dynamic SOQL for this role's list. | |
Mar 6, 2019 at 7:12 | comment | added | user61203 | yeah thats what I am saying, I just gave admin and developer as an example to explain my scenario but I can "n" number of roles over here, so can you help me out on this issue, I can have multiple roles so I just want to group the records which have same role name and rate and add hours of those and show on vf page as a single record. | |
Mar 6, 2019 at 7:10 | comment | added | Manish Mourya | But you mentioned , role only Developer and Admin so this code works only two role , if you want to add role consultant then , we have to write some code of line for it. | |
Mar 6, 2019 at 7:08 | comment | added | user61203 | will it work for other roles, lets say if I have role like "Consultant"?bcoz in code we did not mentioned about consultant | |
Mar 6, 2019 at 7:07 | comment | added | Manish Mourya | Yes I understood your scenario , you just try above code , this will definitely work according your scenario. Thank You , If You got complete satisfaction about your problem then please tik this question as answered. | |
Mar 6, 2019 at 7:04 | history | edited | Manish Mourya | CC BY-SA 4.0 |
added 38 characters in body
|
Mar 6, 2019 at 6:59 | comment | added | user61203 | Hello @Manish Mourya, Thanks a lot for quick reply and giving me the solution, I am new to Apex so just asked help. Regarding my question I just gave example of Admin and Developer but I can have multiple records with multiple Roles, if role name is matched and rate is matched then I want to group all those records and show on vf page with one record which should give sum of hours for matching roles and rates. Can you help me out in this if possible | |
Mar 6, 2019 at 5:34 | comment | added | Manish Mourya | Hi @Venkata Sainath , I hope your problem will be solve , but it's not good approach to reach at the solution , and in this code is covering all conditions as you mentioned in your question, After this you can use to Map for best approach .Thank you. | |
Mar 6, 2019 at 5:26 | history | edited | Manish Mourya | CC BY-SA 4.0 |
added 236 characters in body
|
Mar 5, 2019 at 14:54 | history | edited | sfdcfox♦ | CC BY-SA 4.0 |
added 226 characters in body
|
Mar 5, 2019 at 14:50 | history | answered | Manish Mourya | CC BY-SA 4.0 |