code: public boolean setSelectQuery(Rec recMaint, boolean bUpdateOnSelect)
      {
          if (recMaint == null)
          {
              return true;    // BaseTable Set!
          }
          if (this.getMainRecord() != null)
              if (this.getMainRecord() != recMaint)
                  if (this.getMainRecord().getBaseRecord().getTableNames(false).equals(recMaint.getTableNames(false)))
          {
              this.getMainRecord().addListener(new SelectOnUpdateHandler((Record)recMaint, bUpdateOnSelect));
                  return true;    // BaseTable Set!
          }
          return false;
      }
docs: Find the sub-screen that uses this grid query and set for selection.
  When you select a new record here, you read the same record in the SelectQuery.
  @param recMaint The record which is synced on record change.
  @param bUpdateOnSelect Do I update the current record if a selection occurs.
  @return True if successful.