0
我具有2個字典陣列撰寫。第一部字典按服務分組,並給出了包含我的第二部字典和所有詳細信息的陣列中具有相同服務的公司數量。NSpredicate結果
的第一部字典有2個按鍵公司和服務。
內各公司的我有一個包含我的第二個字典,下面的鍵值
AddressInformation,名稱和服務陣列。
我想NSpredicate消除所有公司名稱 對象從我的第二個字典,不對應於searchText。現在它的過濾過程只發生在第一個字典上。它不斷給我所有從我的第二個字典中的結果,但消除了第一詞典(公司和服務)的唯一對象。
預先感謝!
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY %K.%K CONTAINS[cd] %@", @"Companies",@"Name",searchText]; FilteredObject = [NSMutableArray arrayWithArray:[AllDataGroupbyServiceArray
filteredArrayUsingPredicate:謂詞]];
(
{
Companies = (
{
AddressInformation = h3k2w3;
Name = Teg;
Service = "";
}
);
Services = "";
},
{
Companies = (
{
AddressInformation = j9g2k6;
Name = Megan;
Service = Electrician;
},
{
AddressInformation = h2k2w3;
Name = test;
Service = Electrician;
},
{
AddressInformation = h2t3b3;
Name = Janet;
Service = Electrician;
},
{
AddressInformation = "J4J 1H7";
Name = Rick;
Service = Electrician;
},
{
AddressInformation = "H1T 4B6";
Name = Herber;
Service = Electrician;
},
{
AddressInformation = "J0K 3B0";
Name = test;
Service = Electrician;
},
{
AddressInformation = h2k2w3;
Name = test;
Service = Electrician;
},
{
AddressInformation = h2k2w3;
Name = canada;
Service = Electrician;
}
);
Services = Electrician;
},
{
Companies = (
{
AddressInformation = J0L2K0;
Name = "Colas Bn";
Service = Mason;
},
{
AddressInformation = J5A1M2;
Name = mrnoskill2;
Service = Mason;
},
{
AddressInformation = J0L2K0;
Name = test8;
Service = Mason;
},
{
AddressInformation = J5C1S3;
Name = test6;
Service = Mason;
},
{
AddressInformation = h3r1z2;
Name = Jason;
Service = Mason;
},
{
AddressInformation = j7h2k7;
Name = max;
Service = Mason;
},
{
AddressInformation = J5Z2W5;
Name = Fred;
Service = Mason;
},
{
AddressInformation = "H4G 1K6";
Name = Joe;
Service = Mason;
},
{
AddressInformation = j3y7a6;
Name = Tets;
Service = Mason;
}
);
Services = Mason;
},
{
Companies = (
{
AddressInformation = h2k2w3;
Name = jake;
Service = Plumber;
}
);
Services = Plumber;
}
)