Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Employees<->>ClockPunches
- NSFetchRequest* request = [Registration fetchRequest];
- NSExpression *date = [NSExpression expressionForKeyPath:@"time"];
- NSExpression *maxDate = [NSExpression expressionForFunction:@"max:"
- arguments:[NSArray arrayWithObject:date]];
- NSExpressionDescription *d = [[[NSExpressionDescription alloc] init] autorelease];
- [d setName:@"maxTime"];
- [d setExpression:maxDate];
- [d setExpressionResultType:NSDateAttributeType];
- [request setPropertiesToFetch:[NSArray arrayWithObject:d]];
- NSError *error = nil;
- NSArray *objects = [Registration executeFetchRequest:request];
- if (objects == nil) {
- // Handle the error.
- } else {
- if (0 < [objects count]) {
- NSLog(@"Maximum date: %@", [[objects objectAtIndex:0] valueForKey:@"type"]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement