private bool GetLookupSQL(out string sql) { sql = ""; if (!sys.IsEmpty(СustomQuery)) { sql = СustomQuery; } else if (ObjRef != null) { sql = ObjRef.GetSelectSQLForEditFBA(this); } else { if ((!sys.IsEmpty(EntityBrief)) && (!sys.IsEmpty(AttrBrief))) { string queryName; string attr; string attrLookup; string setting; sys.ParseTag(AttrBrief, out queryName, out attr, out attrLookup, out setting); string maxRecords1 = ""; string maxRecords2 = ""; if (ObjectMaxCount > 0) { if (Var.con.serverTypeRemote == ServerType.MSSQL) { maxRecords1 = " TOP " + ObjectMaxCount.ToString(); } if ((Var.con.serverTypeRemote == ServerType.SQLite) || (Var.con.serverTypeRemote == ServerType.Postgre)) { maxRecords2 = Var.CR + " LIMIT " + ObjectMaxCount.ToString(); } } sql = "SELECT " + maxRecords1 + " " + attrLookup + " FROM " + EntityBrief; if (!sys.IsEmpty(OuterWHERE)) { sql = sql + " WHERE " + OuterWHERE; } sql = sql + maxRecords2; if (!sys.IsEmpty(ObjectOrderBy)) { sql = sql + " ORDER BY " + ObjectOrderBy; } } } if (sql == "") { return(false); } return(true); }