[OGo-Developer] stuffing an NSArray into a NSMutableDictionary

Sebastian Reitenbach developer@opengroupware.org
Tue, 17 Apr 2007 14:45:08 +0200


Hi Rafel,

> 
> can you send an example of the initial values of self->multipleReturn
> and the desired final values?
> 

my initial array looks like this:

Apr 17 14:14:57 ogo-webui-1.1 [23380]: self->multipleReturn: (
    {
        Abandoned = " 0";
        Calls = " 0";
        Completed = " 0";
        Event = " QueueParams";
        Holdtime = " 0";
        Max = " 0";
        Queue = " l00-bugdead-prods-queue";
        ServiceLevel = " 0";
        ServicelevelPerf = " 0.0";
        Weight = " 0";
    },
    {
        Abandoned = " 0";
        Calls = " 0";
        CallsTaken = " 0";
        Completed = " 0";
        Event = " QueueMember";
        Holdtime = " 0";
        LastCall = " 0";
        Location = " Agent/303";
        Max = " 0";
        Membership = " static";
        Paused = " 0";
        Penalty = " 1";
        Queue = " l00-bugdead-prods-queue";
        ServiceLevel = " 0";
        ServicelevelPerf = " 0.0";
        Status = " 4";
        Weight = " 0";
    },
    {
        Abandoned = " 0";
        Calls = " 0";
        CallsTaken = " 0";
        Completed = " 0";
        Event = " QueueMember";
        Holdtime = " 0";
        LastCall = " 0";
        Location = " Agent/202";
        Max = " 0";
        Membership = " static";
        Paused = " 0";
        Penalty = " 0";
        Queue = " l00-bugdead-prods-queue";
        ServiceLevel = " 0";
        ServicelevelPerf = " 0.0";
        Status = " 4";
        Weight = " 0";
    },
    {
        Abandoned = " 0";
        Calls = " 0";
        CallsTaken = " 0";
        Completed = " 0";
        Event = " QueueMember";
        Holdtime = " 0";
        LastCall = " 0";
        Location = " Agent/101";
        Max = " 0";
        Membership = " static";
        Paused = " 0";
        Penalty = " 0";
        Queue = " l00-bugdead-prods-queue";
        ServiceLevel = " 0";
        ServicelevelPerf = " 0.0";
        Status = " 4";
        Weight = " 0";
    }
)

the array above contains all events mixed up, these are QueueParams, and 
QueueMember. I want it to be separated by queue params objects, where the 
members of the given queue are added in the Agents Key, where agents is an 
array. The above example array only contains one object Event QueueParams, 
but there could be more than one. The members are associated to the Queues 
via the Queue parameters. 

and I want it to look like this one here:

self->multipleReturn: (
    {
        Abandoned = " 0";
        Calls = " 0";
        Completed = " 0";
        Event = " QueueParams";
        Holdtime = " 0";
        Max = " 0";
        Queue = " l00-bugdead-prods-queue";
        ServiceLevel = " 0";
        ServicelevelPerf = " 0.0";
        Weight = " 0";
        Members = (
         {
            Abandoned = " 0";
            Calls = " 0";
            CallsTaken = " 0";
            Completed = " 0";
            Event = " QueueMember";
            Holdtime = " 0";
            LastCall = " 0";
            Location = " Agent/303";
            Max = " 0";
            Membership = " static";
            Paused = " 0";
            Penalty = " 1";
            Queue = " l00-bugdead-prods-queue";
            ServiceLevel = " 0";
            ServicelevelPerf = " 0.0";
            Status = " 4";
            Weight = " 0";
         },
         {
            Abandoned = " 0";
            Calls = " 0";
            CallsTaken = " 0";
            Completed = " 0";
            Event = " QueueMember";
            Holdtime = " 0";
            LastCall = " 0";
            Location = " Agent/202";
            Max = " 0";
            Membership = " static";
            Paused = " 0";
            Penalty = " 0";
            Queue = " l00-bugdead-prods-queue";
            ServiceLevel = " 0";
            ServicelevelPerf = " 0.0";
            Status = " 4";
            Weight = " 0";
         },
         {
            Abandoned = " 0";
            Calls = " 0";
            CallsTaken = " 0";
            Completed = " 0";
            Event = " QueueMember";
            Holdtime = " 0";
            LastCall = " 0";
            Location = " Agent/101";
            Max = " 0";
            Membership = " static";
            Paused = " 0";
            Penalty = " 0";
            Queue = " l00-bugdead-prods-queue";
            ServiceLevel = " 0";
            ServicelevelPerf = " 0.0";
            Status = " 4"; 
            Weight = " 0";
          }
        );
    }
)

I am not sure whether an array is the best choice to store the queues in it, 
but at least it fits best with the rest of the OGoAsteriskUI that is working 
so far. So I am open for any suggestion, I'd also drop the idea to store it 
in a array and use a dictionary instead...

kind regards
Sebastian