You need to sign in to do that
Don't have an account?
shakila G
How to do group by in wrapper class?
Hi All,
I wrote a wrapper classs to store the different object value in one list.
Now my wrapper class contain the list like below :
Material Name Qty
Rim 2
Rope 2
Wood 5.666
Rim 7
Wood 2
Rim 0.5555
i want to consolidate this value as like below
Material Name Qty
Rim 9.5555
Rope 2
Wood 7.666
kindly some one guide me to accomplish this.
I wrote a wrapper classs to store the different object value in one list.
Now my wrapper class contain the list like below :
Material Name Qty
Rim 2
Rope 2
Wood 5.666
Rim 7
Wood 2
Rim 0.5555
i want to consolidate this value as like below
Material Name Qty
Rim 9.5555
Rope 2
Wood 7.666
kindly some one guide me to accomplish this.
Hi,
Could you please explain a bit more about structure of your wrapper class and objects you are using?
One approach would be to add a method, starting with the word "get", such as getWrapperList(), and inside this method you could iterate over your list of objects, putting TRUE instances in one list and FALSE instances in another. Then into a final list variable you can use addAll() to add your true then false lists, returning the final list.
Your VF page would then include "{!wrapperList}" to reference the return value of this method.
public List<Wrapper> getWrapperList() {
List<Wrapper> trueList = new List<Wrapper>();
List<Wrapper> falseList = new List<Wrapper>();
for (Wrapper each : myOriginalWrapperList) {
if (each.isTrue)
trueList.add(each);
else
falseList.add(each);
}
List<Wrapper> finalList = new List<Wrapper>();
finalList.addAll(trueList);
finalList.addAll(falseList);
return finalList;
}
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha