Thursday, 15 August 2013

Merge and Sort Contents of Dictionary in an Array

Merge and Sort Contents of Dictionary in an Array

I have an array of dictionaries of options with categories. I want the
options to be under the category. As of now, my categories are repeating
as to how many times my options are added.
Given this:
(
{
multiOptnCatId = 4;
multiOptnItem = 1344;
},
{
multiOptnCatId = 7;
multiOptnItem = 2253;
},
{
multiOptnCatId = 4;
multiOptnItem = 1343;
},
{
multiOptnCatId = 4;
multiOptnItem = 1346;
},
{
multiOptnCatId = 4;
multiOptnItem = 1342;
},
{
multiOptnCatId = 4;
multiOptnItem = 1345;
}
)
What's the efficient way I can convert it to:
(
{
multiOptnCatId = 4;
multiOptnItem = (1342, 1343, 1344, 1345, 1346);
},
{
multiOptnCatId = 7;
multiOptnItem = (2253);
}
)
Thank you guys! :)

No comments:

Post a Comment