You need to sign in to do that
Don't have an account?

list id's help
i have 2 queries and i bought the id of the two queries into two variables now i want them both in one variable how can i do that
workItemListstep = [Select p.ProcessInstance.TargetObjectId,p.ProcessInstanceId,p.OriginalActorId,p.Id,p.ActorId,p.Actor.name From ProcessInstancestep p where p.ProcessInstance.TargetObjectId = :ID ]; workItemListitem = [Select p.ProcessInstance.TargetObjectId,p.ProcessInstanceId,p.OriginalActorId,p.Id,p.ActorId,p.Actor.name From ProcessInstanceworkitem p where p.ProcessInstance.TargetObjectId = :ID ]; set<id> ff=new set<id>(); for(ProcessInstancestep workItemListstep1:workItemListstep) { ff.add(workItemListstep1.id); } set<id> ff1=new set<id>(); for(ProcessInstanceworkitem workItemListitem1:workItemListitem) { ff1.add(workItemListitem1.id); }
here i bought the id's into two different sets now i want all these id's into 1 set how can i do that plz help
You can use Set.addAll method. s1 is a set s2 is a set then take s3 and try s3.addall(s1) and s3.addAll(s2).
Example:
set<string> myString =
new Set<String>{'a', 'b'};
set<string> sString =
new Set<String>{'c'};
set<string> s1= new Set<String>();
s1.addall(myString);
s1.addAll(sString);
System.Debug(s1);
Hope that helps..
Regards,
J
All Answers
You can use Set.addAll method. s1 is a set s2 is a set then take s3 and try s3.addall(s1) and s3.addAll(s2).
Example:
set<string> myString =
new Set<String>{'a', 'b'};
set<string> sString =
new Set<String>{'c'};
set<string> s1= new Set<String>();
s1.addall(myString);
s1.addAll(sString);
System.Debug(s1);
Hope that helps..
Regards,
J
hi jo
thanks for u r reply but its a bit confusing can u apply it to my code and rewrite it please jo
soory in the beginning i was a bit confused but now i got it and its working that a great help