iphone+How to get the final couter values in dictionary
<p>I have array of dictionary values and have implemented the counter method for individual array items but had problem with getting the final counter values. it was adding  individual counter values.</p>

<p>here is the source code.</p>

<pre><code>-(void)getData
{
[lReportArr removeAllObjects];
    lMetaCount = 0;
    NSMutableArray *lTempArr = [[NSMutableArray alloc] initWithArray:lMetaArray];
    NSLog(@"Metabolic Array:-%@", lTempArr);
    for (int i = 0; i &lt; [lTempArr count]; i++)
    {
        NSMutableDictionary *lDict = [lTempArr objectAtIndex:i];

        NSString *lTitle = [lDict objectForKey:@"title"];
        //Glucose Low count
        if ([lTitle rangeOfString:@"Glucose reading : Low"].length &gt; 0) 
        {
            lMetaCount++;
            NSString *lCount = [NSString stringWithFormat:@"Low BG:%d",lMetaCount];
            [lDict setValue:lCount forKey:@"metabolicCount"];
        }
        //Glucose High count
        else if ([lTitle rangeOfString:@"Glucose reading : High"].length &gt; 0) 
        {
            lMetaCount++;
            NSString *lCount = [NSString stringWithFormat:@"High BG:%d",lMetaCount];
            [lDict setValue:lCount forKey:@"metabolicCount"];
        }
        //Wrong Dose Cause count
        else if([lTitle rangeOfString:@"Low Cause: Wrong Dose"].length &gt; 0)
        {
            lMetaCount++;
            NSString *lCount = [NSString stringWithFormat:@"LG Wrong Dose:%d",lMetaCount];
            [lDict setValue:lCount forKey:@"metabolicCount"];
        }
        else if([lTitle rangeOfString:@"High Cause: Wrong Dose"].length &gt; 0)
        {
            lMetaCount++;
            NSString *lCount = [NSString stringWithFormat:@"HG Wrong Dose:%d",lMetaCount];
            [lDict setValue:lCount forKey:@"metabolicCount"];
        }
        //Symptoms Cause count
        else if([lTitle rangeOfString:@"Low Cause: Illness"].length &gt; 0)
        {
            lMetaCount++;
            NSString *lCount = [NSString stringWithFormat:@"LG Illness:%d",lMetaCount];
            [lDict setValue:lCount forKey:@"metabolicCount"];
        }
        else if([lTitle rangeOfString:@"High Cause: Illness"].length &gt; 0)
        {
            lMetaCount++;
            NSString *lCount = [NSString stringWithFormat:@"HG Symptoms:%d",lMetaCount];
            [lDict setValue:lCount forKey:@"metabolicCount"];
        }
        //LG n HG Treatment count
        else if([lTitle rangeOfString:@"Treatment: Emergency Room"].length &gt; 0)
        {
            lMetaCount++;
            NSString *lCount = [NSString stringWithFormat:@"Emergency Room:%d",lMetaCount];
            [lDict setValue:lCount forKey:@"metabolicCount"];
        }
        else if([lTitle rangeOfString:@"Treatment: Hospitalization"].length &gt; 0)
        {
            lMetaCount++;
            NSString *lCount = [NSString stringWithFormat:@"Hospitalization:%d",lMetaCount];
            [lDict setValue:lCount forKey:@"metabolicCount"];
        }
        else if([lTitle rangeOfString:@"Treatment: Extra MD Office"].length &gt; 0)
        {
            lMetaCount++;
            NSString *lCount = [NSString stringWithFormat:@"Extra MD Office:%d",lMetaCount];
            [lDict setValue:lCount forKey:@"metabolicCount"];
        }
        [lReportArr addObject:lDict];

    }
}
</code></pre>
