Search Results

Search found 3 results on 1 pages for 'danf'.

Page 1/1 | 1 

  • Displaying a To-Many Relationship in a Table View

    - by DanF
    I've got an application I've been working on. There are projects and employees, projects can have several employees, employees can work on several projects. Right now I want selecting a project to display which employees are related to it, and allows me to add employees I select from another full-roster list. Somehow, this has proven more complicated, because (at least for now), selecting different projects still displays the same list of employees, as if all employees who'd been assigned to any project, belong to all of them. What part of Master-Detail am I missing?

    Read the article

  • After I apply custom logic, next UI action crashes my app.

    - by DanF
    I've got an team (eveningRoster) that I'm making a button add employees to. The team is really a relationship to that night's event, but it's represented with an AC. I wanted to make sure an employee did not belong to the team before it adds, so I added a method to MyDocument to check first. It seems to work, the error logs complete, but after I've added a member, the next time I click anything, the program crashes. Any guesses why? Here's the code: -(IBAction)playsTonight:(id)sender { NSArray *selection = [fullRoster selectedObjects]; NSArray *existing = [eveningRoster arrangedObjects]; //Result will be within each loop. BOOL result; //noDuplicates will stay YES until a duplicate is found. BOOL noDuplicates = YES; //For the loop: int count; for (count = 0; count < [selection count]; count++){ result = [existing containsObject:[selection objectAtIndex:count]]; if (result == YES){ NSLog(@"Duplicate found!"); noDuplicates = NO; } } if (noDuplicates == YES){ [eveningRoster addObjects:[fullRoster selectedObjects]]; NSLog(@"selected objects added."); [eveningTable reloadData]; NSLog(@"Table reloaded."); } [selection release]; [existing release]; return; }

    Read the article

  • Retrieving Relationships from within two arrays of pointers

    - by DanF
    In a portion of a program I'm working on, I need to count all the times each person has worked on projects with each other person. Let's say we have "Employee" entities and "Session" entities. In each session, there are four project types, "A", "B", "C", & "D", each a many-to-many relationship to Employees. I'm making a loop to systematically review every person a selected person has worked with. First, I put all their project types in a single array, so it's easier to loop through, but by the time I ask the last nested Project for its Employee members, I get an "unrecognized selector" error. IBOutlet NSArrayController * list; int x; for(x = 0; x < [list count]; x++){ NSArray *A = [[list objectAtIndex:x] valueForKey:@"projectAs"]; NSArray *A = [[list objectAtIndex:x] valueForKey:@"projectBs"]; NSArray *A = [[list objectAtIndex:x] valueForKey:@"projectCs"]; NSArray *A = [[list objectAtIndex:x] valueForKey:@"projectDs"]; NSArray *masterList = [[NSArray alloc] initWithObjects: projectAs, projectBs, projectCs, projectDs, nil]; int y; for(y = 0; y < [masterList count]; y++){ int z; for(z = 0; z < [[masterlist objectAtIndex:y] count]; z++){ //And now to make an Array of this employee's partners on the selected object, to run comparisons on. //I also have an array of keys for each session's teams, so that's what I'm referencing here: NSArray * thisTeam = [list objectAtIndex:y] objectAtIndex:z] valueForKey:projectKey]; This throws an exception... namely, -[_NSFaultingMutableSet objectAtIndex:]: unrecognized selector sent to instance What's wrong with that last Array creation?

    Read the article

1