HI i have a following array of dictionaries and and i want to sort the array using the the key "BirthDate" and my code is as follows
NSLog(@"nodeEventArray == %@", temp);
NSSortDescriptor *dateDescriptor = [NSSortDescriptor
sortDescriptorWithKey:@"BirthDate"
ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:dateDescriptor];
NSArray *sortedEventArray = [temp
sortedArrayUsingDescriptors:sortDescriptors];
NSLog(@"sortedEventArray == %@", sortedEventArray);
but I was unable to sort properly can any one please tell me how to sort the array of dictionary based on "BirthDate" key .Since birth date is coming as string from service
sample array of dictionaries:
nodeEventArray = (
{
BirthDate = "05/04/1986";
Email = "";
FirstName = Test;
IsSpouse = 0;
LastName = Test;
MiddleInitial = "";
PatientID = "";
Phone = "";
ScacntronCSVId = 40409;
SlotID = 1;
UserName = "Tes_02192013010055";
},
{
BirthDate = "02/14/1986";
Email = "";
FirstName = Guest;
IsSpouse = 0;
LastName = Guest;
MiddleInitial = "";
PatientID = "";
Phone = "";
ScacntronCSVId = 40410;
SlotID = 2;
UserName = "Gue_02192013014725";
},
{
BirthDate = "02/17/1987";
Email = "";
FirstName = User;
IsSpouse = 0;
LastName = User;
MiddleInitial = "";
PatientID = "";
Phone = "";
ScacntronCSVId = 40411;
SlotID = 3;
UserName = "Use_02192013020726";
}
)