Below is my code..
dataArray = [[response valueForKey:@"data"]mutableCopy];
NSPredicate *departmentPredicate =
[NSPredicate predicateWithFormat:@"department == %@",selectedDepartment];
doctorsArray =[[dataArray filteredArrayUsingPredicate:departmentPredicate]mutableCopy];
doctorsNameArray = [[doctorsArray valueForKey:@"doctors"]mutableCopy];
doctorsListArray = [[doctorsNameArray valueForKey:@"name"]mutableCopy];
data array (4 elements)
<__NSArrayM 0x7ca81f10>(
{
department = Endodontics;
doctors = (
{
id = 11;
name = "Dr Alex";
}
);
id = 7;
},
{
department = "Operative Dentistry";
doctors = (
{
id = 9;
name = "Dr Amal K Ramachandran";
},
{
id = 6;
name = "Dr Rahman";
},
{
id = 10;
name = "Dr varsha";
}
);
id = 8;
},
{
department = Othondontics;
doctors = (
{
id = 8;
name = "Dr. Rashid KC";
},
{
id = 5;
name = Prasad;
}
);
id = 5;
},
{
department = Periodontics;
doctors = (
{
id = 7;
name = "Dr Sreya Vishwanath";
}
);
id = 6;
}
)
doctors array (1 element)
<__NSArrayM 0x7c9553e0>(
{
department = Othondontics;
doctors = (
{
id = 8;
name = "Dr. Rashid KC";
},
{
id = 5;
name = Prasad;
}
);
id = 5;
}
)
doctors name array
<__NSArrayM 0x7c94ef10>(
<__NSArrayI 0x7c921ea0>(
{
id = 8;
name = "Dr. Rashid KC";
},
{
id = 5;
name = Prasad;
}
)
)
doctors list array (1 element)
<__NSArrayM 0x7b760ba0>(
<__NSArrayI 0x7ca836f0>(
Dr. Rashid KC,
Prasad
)
)
The problem is doctors array, doctor name array, doctors list array contains more than 1 elemnt, but stores as 1 element..