title: How to Use Relational Queries Parse iOS to populate a UITableView?
body: <p>I'm developing a social app and have some problems with populating objects from parse created in a selected cell. </p>
  
  <p>The Home screen is a UITableViewController, populates an array of objects stored in Parse, when a user taps a cell, a new scene DetailViewController will be pushed, which shows the object from the selected cell in a view.</p>
  
  <p>Next, I created in DetailViewController a UIButton to add objects to a new class called "replies" and also have added into the DetailViewController scene, a TableView which is populated using a new array from those objects at the "replies" class. </p>
  
  <p>I want to retrieve just the objects created on the selected cell :( At the moment everything works fine except on the DetailViewController scene the TableView will show all the objects created in the "replies" class no matter on which cell I tap.</p>
  
  <p>I wonder how would I store an array from the selected cell so I can populate the objects that have been created at that selected cell... I believe that I could solve this issue with relational queries from parse at the retrieve from parse method. </p>
  
  <p>Would Appreciate Very Much Any Help.</p>
  
  <p><strong>.h file</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import &lt;Parse/Parse.h&gt;
  #import &lt;ParseUI/ParseUI.h&gt;
  #import "GroundTableViewCell.h"
  #import "TimelineTableViewController.h"
  
  @interface DetailViewController : UIViewController&lt;
  UITableViewDataSource,
  UITableViewDelegate,
  NSObject&gt;
  {
  }
  
  @property (strong, nonatomic) IBOutlet UITableView *detailTableView;
  @property (strong, nonatomic) IBOutlet UITextView *TextField;
  @property (nonatomic, strong) PFObject *groUnds;
  @property (strong, nonatomic) IBOutlet UITextView *replyTextView;
  - (IBAction)sendReply:(id)sender;
  
  @end
  </code></pre>
  
  <p><strong>.m file</strong></p>
  
  <pre><code>#import "DetailViewController.h"
  #import &lt;Parse/Parse.h&gt;
  #import "GroundTableViewCell.h"
  #import "TimelineTableViewController.h"
  
  @interface DetailViewController ()
  @property(strong)NSMutableArray* repliesMutableArray;
  
  @end
  
  @implementation DetailViewController
  
  @synthesize groUnds;
  @synthesize TextField;
  @synthesize detailTableView;
  @synthesize repliesMutableArray;
  
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
      if (self) {
          // Custom initialization
      }
      return self;
  }
  
  - (void)viewDidLoad {
      [super viewDidLoad];
  
      PFUser *currentUser = [PFUser currentUser];
      if (currentUser) {
          // do stuff with the user
      } else {
          // show the signup or login screen
      }
  
      // Do any additional setup after loading the view.
  //      [self performSelector:@selector(retrieveFromParse)];
  //    repliesArray = [[NSArray alloc] initWithObjects:@"comment", nil];
  
         [self performSelector:@selector(retrieveFromParse)];
  
      // Set the Label text with the selected detail.
      self.TextField.text = [self.groUnds objectForKey:@"comment"];
  }
  
  - (void) retrieveFromParse {
      PFQuery *retrieveReplies = [PFQuery queryWithClassName:@"Replies"];
  
    // This is the part where im not really sure how to query...
   // if uncommented won't show any objects at all now shows all the objects from the "Replies class" --&gt;
    //  [retrieveReplies whereKey:@"comment" equalTo:groUnds];
      [retrieveReplies orderByDescending:@"createdAt"];
  
      [retrieveReplies findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
          if (!error) {
              repliesMutableArray = [[NSMutableArray alloc] initWithArray:objects];
          }
          [detailTableView reloadData];
      }];
  }
  
  //*********************Setup table of folder names ************************
  //get number of sections in tableview
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
      // Return the number of sections.
      return 1;
  }
  
  //get number of rows by counting number of folders
  -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
      return [repliesMutableArray count ];
  }
  
  //setup cells in tableView
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      static NSString *CellIdentifier = @"replyCell";
      GroundTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  
      PFObject *tempObject = [repliesMutableArray objectAtIndex:indexPath.row];
      cell.cellTitle.text = [tempObject objectForKey:@"commentReplies"];
  
      return cell;
  }
  
  - (void)didReceiveMemoryWarning {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
   //reply button
  - (IBAction)sendReply:(id)sender {
      //1
      //Add the image to the object, and add the comment and the user
      PFObject *Reply = [PFObject objectWithClassName:@"Replies"];
      [Reply setObject:[PFUser currentUser].username forKey:@"user"];
      [Reply setObject:self.replyTextView.text forKey:@"commentReplies"];
      //2
      [Reply saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
          //3
          if (succeeded){
              //Go back to the wall
              [self.navigationController popViewControllerAnimated:YES];
          }
          else{
              NSString *errorString = [[error userInfo] objectForKey:@"error"];
              UIAlertView *errorAlertView = [[UIAlertView alloc] initWithTitle:@"Error" message:errorString delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
              [errorAlertView show];
          }
      }];
  }
  
  @end
  </code></pre>