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 8584995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:57:00+00:00 2026-06-11T21:57:00+00:00

I have a structured array like the one below ( { id = 0;

  • 0

I have a structured array like the one below

 (
        {
        id = 0;
        name = "A";
        tables =         (
                        {
                comment = "";
                id = 0;
                name = "T1";
            },
                        {
                comment = "";
                id = 1;
                name = "T2";
            },
                        {
                comment = "";
                id = 4;
                name = "T3";
            }
        );
    },
        {
        id = 1;
        name = "B";
        tables =         (
                        {
                comment = "";
                id = 5;
                name = "T1";
            },
                        {
                comment = "";
                id = 6;
                name = "T2";
            }
        );
    }
) 

Given that I know the value of id key of one of the dictionaries (let’s take id=6), how can I get its parent dictionary or to be more precise the value of name key (in this case B).

I’ve tried using predicate strings but the problem is that the parent dictionary has also a key named id, so I get the wrong results.

EDIT: id keys are unique (and it is also not necessary that ids of the elements in the first dictionary have lower intiger values than the ones in the dictionaries with higher indexes)

  • 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-11T21:57:01+00:00Added an answer on June 11, 2026 at 9:57 pm

    Try this, where array is your structured array

    NSDictionary *parentDict=[[NSDictionary alloc]initWithDictionary:nil];
    NSString *name=[[NSString alloc]init];
    NSArray *table=[[NSArray alloc]initWithArray:nil];
    for (NSDictionary * dict in array) {
        table=[dict objectForKey:@"tables"];
        for (NSDictionary *childDict in table) {
            if ([[childDict objectForKey:@"id"]isEqualToString:@"6"]) {
                //if your id value is int then use ==6 to check 
                parentDict=dict;
                name=[dict objectForKey:@"name"];
                return;                
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does VBA have dictionary structure? Like key<>value array?
I have structure containing an array. Something like given below: struct Node { int
I have a NumPy array [1,2,3,4,5,6,7,8,9,10,11,12,13,14] and want to have an array structured like
I have this array {$man_data} which is structured like 10 > 'Text 8' 14
I have an array structure that looks like this: Array ( [0] => Array
If I have a plist which is structured like this: Root Array Item 0
I have a bunch of strings structured like this one Trim(2714,8256)++Trim(10056,26448)++Trim(28248,49165) and what I
i have an array structured like: $something = array( 0 => array( 'label' =>
I have an array structured like this: $arrNames = array( array('first'=>'John', 'last'=>'Smith', 'id'=>'1'), array('first'=>'John',
i would like create a array of structure which have a dynamic array :

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.