Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7905235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:23:59+00:00 2026-06-03T10:23:59+00:00

I have a problem when trying to retrieve values from an array. I want

  • 0

I have a problem when trying to retrieve values from an array.
I want to get all the values from this array in order to display them in a IUTableView.

Should I use a double for function ?

{
1 =     {
    dishId = 1;
    dishName = "Tomato Salades";
    dishPrice = 13;
    dishTypeId = 1;
    dishTypeName = Starter;
};
2 =     {
    dishId = 2;
    dishName = "Leeks Salades";
    dishPrice = 12;
    dishTypeId = 1;
    dishTypeName = Starter;
};
3 =     {
    dishId = 3;
    dishName = Fries;
    dishPrice = 14;
    dishTypeId = 2;
    dishTypeName = "Main Course";
};
4 =     {
    dishId = 4;
    dishName = Beef;
    dishPrice = 15;
    dishTypeId = 2;
    dishTypeName = "Main Course";
};
7 =     {
    dishId = 7;
    dishName = "Cheese Cake";
    dishPrice = 8;
    dishTypeId = 3;
    dishTypeName = Dessert;
};
menuCountry = France;
menuDescription = "un menu pas comme les autres pour une region pas comme les autres";
menuId = 1;
menuName = "Autour de l\\Alsace";
menuState = 1;
}

This is my Python code which creates a Dictionary in a Array :

def getDishOfTheWeek():
menuArray = []
menuDic = Ddict(dict)
    for menu in Menus.select().where(state=True):

        menuDic['menuId']=menu.id
        menuDic['menuName']=menu.name
        menuDic['menuCountry']=menu.country.name
        menuDic['menuDescription']=menu.description
        menuDic['menuState']=menu.state
        for d in  DishMenuRels.select().where(menu = menu.id).join(Dishes).join(DishTypes).order_by((DishTypes,'name')):
            menuDic[str(d.dish.id)] = {}
            menuDic[str(d.dish.id)]['dishTypeName'] = d.dish.dishType.name
            menuDic[str(d.dish.id)]['dishTypeId'] = d.dish.dishType.id
            menuDic[str(d.dish.id)]['dishId'] = d.dish.id
            menuDic[str(d.dish.id)]['dishName'] = d.dish.name
            menuDic[str(d.dish.id)]['dishPrice'] = d.dish.price
menuArray.append(menuDic)
return json.dumps(menuArray)

This is my Objectiv-C code in order to get the DataJson and put it in an Array:

- (void)stream:(NSStream *)theStream handleEvent:(NSStreamEvent)streamEvent {

switch (streamEvent) {

    case NSStreamEventOpenCompleted:
        [[ConnectionSingleton getInstance] setConnectionMade:YES];
        NSLog(@"Stream opened");
        break;

    case NSStreamEventHasBytesAvailable:
        if (theStream == inputStream) {

            uint8_t buffer[1024];
            int len;

            while ([inputStream hasBytesAvailable]) {

                len = [inputStream read:buffer maxLength:sizeof(buffer)];

                if (len > 0) {

                    NSString *output = [[NSString alloc] initWithBytes:buffer length:len encoding:NSASCIIStringEncoding];

                    output = [output substringToIndex:[output length] - 2];

                    if (nil != output) {
                        NSError* error;     // Obligatoir pour le JSON

                        menu = [NSJSONSerialization JSONObjectWithData:[output dataUsingEncoding:NSUTF8StringEncoding] options:
                                  NSJSONReadingMutableContainers error:&error];   // Put Json in the Array


                        [[self tableView] reloadData];  // Reload Array to populate it
                    }
                }
            }
        }
        break;      

    case NSStreamEventErrorOccurred:
        NSLog(@"Can not connect to the host!");
        break;

    case NSStreamEventEndEncountered:
        break;

    default:
        NSLog(@"Unknown event");
}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:24:00+00:00Added an answer on June 3, 2026 at 10:24 am

    I think this should do the trick

    NSArray *firstArray = [NSArray arrayWithObjects:[NSArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",nil], [NSArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",nil],[NSArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",nil],[NSArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",nil],[NSArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",nil],@"String",@"String",@"String",@"String",@"String",nil];
    
    NSInteger count_i = firstArray.count;
    NSInteger count_j;
    id val;
    for (NSInteger i = 0; i < count_i; i++) {
        if ([[firstArray objectAtIndex:i] isKindOfClass:[NSArray class]]) {
            count_j = [[firstArray objectAtIndex:i] count];
            for (NSUInteger j = 0; j < count_j; j++) {
                val = [[firstArray objectAtIndex:i] objectAtIndex:j]; 
                NSLog(@"%@",val);
            }
        }else{
            val = [firstArray objectAtIndex:i];
            NSLog(@"%@",val);
        }
    }
    

    But your values are of different types, so you have to deal with them in different ways depending of the value of j.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a serious problem. Firstly, I am trying to retrieve values from my
I have next problem, when I'm trying to retrieve value from xforms:select elements I
Hey all, i have a problem with trying to get 2 forms to close
I have a problem trying to hide .php extension from the url I have
I have a problem when trying to execute this update statement (below) using C#
I have this problem when trying to run hello world program using android SDK.
I have a strange problem while trying to start JBoss from Eclipse. After starting,
Hi all and thanks for your time in advance. I have a problem trying
I'm trying to create a stored procedure to retrieve value from multiple. The problem
I have stored values retrieved from a text file into an array. Now am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.