private void ParseOperand(PXGraph graph, List <IBqlParameter> pars, List <Type> tables, List <Type> fields, List <IBqlSortColumn> sortColumns, StringBuilder text, PX.Data.BqlCommand.Selection selection) { BqlCommand.EqualityList list = fields as BqlCommand.EqualityList; if (list != null) { list.NonStrict = true; } if (!typeof(IBqlCreator).IsAssignableFrom(typeof(UserID))) { if (graph != null && text != null) { text.Append(" ").Append(BqlCommand.GetSingleField(typeof(UserID), graph, tables, selection, BqlCommand.FieldPlace.Condition)); } if (fields != null) { fields.Add(typeof(UserID)); } } else { if (_operand == null) { _operand = _operand.createOperand <UserID>(); } _operand.Parse(graph, pars, tables, fields, sortColumns, text, selection); } }
public virtual bool AppendExpression(ref SQLExpression exp, PXGraph graph, BqlCommandInfo info, BqlCommand.Selection selection) { bool status = true; if (info.Fields is BqlCommand.EqualityList list) { list.NonStrict = true; } SQLExpression opUser = null; if (!typeof(IBqlCreator).IsAssignableFrom(typeof(OperandUser))) { if (info.BuildExpression) { opUser = BqlCommand.GetSingleExpression(typeof(OperandUser), graph, info.Tables, selection, BqlCommand.FieldPlace.Condition); } info.Fields?.Add(typeof(OperandUser)); } else { if (_operandUser == null) { _operandUser = _operandUser.createOperand <OperandUser>(); } status &= _operandUser.AppendExpression(ref opUser, graph, info, selection); } Query qin = new Query(); qin[typeof(EPCompanyTreeH.workGroupID)].From(typeof(EPCompanyTreeH)) .Join(typeof(EPCompanyTreeMember)) .On(SQLExpression.EQ(typeof(EPCompanyTreeH.parentWGID), typeof(EPCompanyTreeMember.workGroupID)) //.And(Column.SQLColumn(typeof(EPCompanyTreeH.parentWGID)).NotEqual(Column.SQLColumn(typeof(EPCompanyTreeH.workGroupID))) .And(Column.SQLColumn(typeof(EPCompanyTreeMember.active)).EQ(1)) .And(Column.SQLColumn(typeof(EPCompanyTreeMember.userID)).EQ(opUser))) //) .Where(new SQLConst(1).EQ(1)); Query qout = new Query(); //Append Tail removes main object, so we fieldNote will not be mapped. Skipping conditions for AppendTail if (info.Tables == null || info.Tables.Count <= 0 || info.Tables.Contains(BqlCommand.GetItemType <FieldNote>())) { qout[typeof(EntityWorkgroup.refNoteID)].From(typeof(EntityWorkgroup)) .Where(Column.SQLColumn(typeof(EntityWorkgroup.workGroupID)).In(qin) .And(SQLExpression.EQ(typeof(EntityWorkgroup.refNoteID), typeof(FieldNote)))); } else { qout[typeof(EntityWorkgroup.refNoteID)].From(typeof(EntityWorkgroup)) .Where(Column.SQLColumn(typeof(EntityWorkgroup.workGroupID)).In(qin)); } qout.Limit(-1); // prevent limiting of IN subqueries exp = exp.In(qout); return(status); }