You need to sign in to do that
Don't have an account?
dgindy
???
Combining results
Is it possible to Union the SOSQL statement before returning it to the VF page?
Code:
t1=[Select WhatId,Name__c,Description,ActivityDate,ActivityDateTime,Id,OwnerId,TimeConverted__c,RelatedName__c,Owner.Name from Event where Type='In-Service' and (ActivityDate = THIS_MONTH or ActivityDate = NEXT_WEEK) and (Owner.UserRole.ParentRoleId=:GroupId or ownerid=:Userid)]; t2=[Select WhatId,Name__c,Description,ActivityDate,ActivityDateTime,Id,OwnerId,TimeConverted__c,RelatedName__c,Owner.Name from Event where Type='In-Service' and (ActivityDate =LAST_N_DAYS:30) and Status__c='Completed' and (Owner.UserRole.ParentRoleId=:GroupId or ownerid=:Userid)]; [Union T1 T2]—–˜™
???
I have two seperate searchs i wish to return and display.
Thanks
1) For efficiency, you could combine those two queries into one. You would just need to make small modifications to the Where clause.
2) If you keep the queries separate, then you could combine the two Event arrays (which contain the query results) into a single Event[]
For example:
Account[] a1 = [select id from account limit 2];
Account[] a2 = [select id from account limit 2];
Account[] a3 = new Account[]{};
for(Account tempAccount : a1)
a3.add(tempAccount);
for(Account tempAccount : a2)
a3.add(tempAccount);