/// <summary>
        /// find unique index in the fields, mark indexed attribute, set query.SingleTableName
        /// </summary>
        /// <param name="fields">fields to set indexed attributes</param>
        /// <returns>true: index found</returns>
        public bool MarkUniqueIndexFields(FieldList fields)
        {
            bool bFound = false;

            if (srcType == enumRecSource.Table)
            {
                if (tableDef != null)
                {
                    if (tableDef.Indexes != null)
                    {
                        int i;
                        for (i = 0; i < tableDef.Indexes.Length; i++)
                        {
                            if (tableDef.Indexes[i].IsUnique)
                            {
                                bFound = true;
                                List <EPField> idxFields = new List <EPField>();
                                for (int k = 0; k < tableDef.Indexes[i].fields.Count; k++)
                                {
                                    EPField fld = fields.FindField(tableDef.TableName, tableDef.Indexes[i].fields[k].Name);
                                    if (fld == null)
                                    {
                                        bFound = false;
                                        break;
                                    }
                                    else
                                    {
                                        idxFields.Add(fld);
                                    }
                                }
                                if (bFound)
                                {
                                    for (int k = 0; k < fields.Count; k++)
                                    {
                                        fields[k].Indexed = false;
                                    }
                                    for (int k = 0; k < idxFields.Count; k++)
                                    {
                                        idxFields[k].Indexed = true;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(bFound);
        }