Search code examples
ios5sudzc

Grabbing multiple rows from sudzc


I'm trying to return multiple rows from a sudzc wsdl. I have loaded the result into a dictionary. The code below gives me the first result. How do I retrieve all of the results instead of just the first one? I'm looking for CSHR_POS_NAME where [ID.text intValue] == CSHR_NUM.

dict = [resp objectForKey:@"TC"];
if( ( dict == nil ) || ![dict isKindOfClass:[NSDictionary class]] ) {
    NSLog( @"WARNING: %@", [dict description]);
    return;
}
    desc = [[dict objectForKey:@"CSHR_POS_NAME"]copy];
    CashierNum = [[dict objectForKey:@"CSHR_NUM"]copy];

    NSLog(@"Name: %@ and Cashier Number: %@",desc, CashierNum);

I was able to accomplish in vb:

If dsCashiers.Table("TC").Rows.Count > 0 Then
...

Solution

  • [d setObject:v forKey:[child name]]; 
    NSString* key = [child name]; 
    id check = [d objectForKey:key]; 
    if( check != nil ) { 
    
    NSInteger next = 1; 
    key = [NSString stringWithFormat:@"%@%d", [child name], next]; 
    check = [d objectForKey:key]; 
    while( check != nil ) { 
    
        next++; 
        key = [NSString stringWithFormat:@"%@%d", [child name], next]; 
        check = [d objectForKey:key]; 
    } 
    [d setObject:v forKey:key]; 
    } 
    [d setObject:v forKey:[child name]];