I know I just asked a similar question recently, but I am still having an issue. I really need to be able to use a dynamic value in the PXSelectBase command.
In this code, I am overriding a PXSelectBase command. (public delegate PXSelectBase GetShipmentsSelectCommandDelegate(SOShipmentFilter filter);) One of my overrides works, but the one with the GroupBy / Having clause fails.
This one works. Note that the And is pulling from the ICSProcShipPref.QtyLessThan field in my custom table. If I change the value in the table, the result set comes back as I would expect. This allows me to use a dynamic amount to be selected based on the value in the table at run time (not have to use a constant).
cmd = new
SelectFrom<SOShipment>.
InnerJoin<INSite>.On<SOShipment.FK.Site>.
InnerJoin<Customer>.On<SOShipment.customerID.IsEqual<Customer.bAccountID>>.SingleTableOnly.
InnerJoin<SOOrderShipment>.On<SOOrderShipment.shipmentNbr.IsEqual<SOShipment.shipmentNbr>>.SingleTableOnly.
LeftJoin<Carrier>.On<SOShipment.FK.Carrier>.
//LeftJoin<ICSProcShipPref>.On<SOShipment.FK.Carrier>.
Where<
SOShipment.confirmed.IsEqual<True>.
And<Match<Customer, AccessInfo.userName.FromCurrent>>.
And<Match<INSite, AccessInfo.userName.FromCurrent>>.
And<Exists<
SelectFrom<SOOrderShipment>.
Where<
SOOrderShipment.shipmentNbr.IsEqual<SOShipment.shipmentNbr>.
And<SOOrderShipment.shipmentType.IsEqual<SOShipment.shipmentType>>.
And<SOOrderShipment.invoiceNbr.IsNull>.
And<SOOrderShipment.createARDoc.IsEqual<True>>>>>.
And<SOOrderShipment.shipmentQty.IsLess<ICSProcShipPref.qtyLessThan.FromCurrent>>>.
View(Base);
break;
In this statement, I am doing something very similar. I am adding a join to the SOShipLine and SOLine tables to get a count of the lines in the SOLine table for the current shipment.
cmd = new
SelectFrom<SOShipment>.
InnerJoin<INSite>.On<SOShipment.FK.Site>.
InnerJoin<Customer>.On<SOShipment.customerID.IsEqual<Customer.bAccountID>>.SingleTableOnly.
InnerJoin<SOShipLine>.On<SOShipLine.shipmentNbr.IsEqual<SOShipment.shipmentNbr>>.
InnerJoin<SOLine>.On<SOLine.orderNbr.IsEqual<SOShipLine.origOrderNbr>.
And<SOLine.orderType.IsEqual<SOShipLine.origOrderType>>.
And<SOLine.lineNbr.IsEqual<SOShipLine.origLineNbr>>>.
LeftJoin<Carrier>.On<SOShipment.FK.Carrier>.
//LeftJoin<ICSProcShipPref>.On<SOShipment.FK.Carrier>.
Where<
SOShipment.confirmed.IsEqual<True>.
And<Match<Customer, AccessInfo.userName.FromCurrent>>.
And<Match<INSite, AccessInfo.userName.FromCurrent>>.
And<Exists<
SelectFrom<SOOrderShipment>.
Where<
SOOrderShipment.shipmentNbr.IsEqual<SOShipment.shipmentNbr>.
And<SOOrderShipment.shipmentType.IsEqual<SOShipment.shipmentType>>.
And<SOOrderShipment.invoiceNbr.IsNull>.
And<SOOrderShipment.createARDoc.IsEqual<True>>>>>>.
AggregateTo<GroupBy<SOLine.orderNbr, Count<SOLine.orderNbr>>>.
Having<Count.IsGreater<ICSProcShipPref.pickMedium.FromCurrent>>.
//Having<Count.IsGreater<Ten>>.
View(Base);
If I use Having<Count.IsGreater<Ten>>. it works. This is hard coding 10 as a constant.
If I use Having<Count.IsGreater<ICSProcShipPref.pickMedium.FromCurrent>>. I get an error at run time.
I am able to use my custom table to pull the ICSProcShipPref.qtyLessThan.FromCurrent in the first example. Why doesn’t it work in my Having clause when I try to do the same thing by pulling from ICSProcShipPref.pickMedium.FromCurrent?
Just to be clear, if I use a constant Ten, it works fine.
I’ve tried adding a Usr field (extension) to the filter and using that instead of my custom table, but I get the same error.
Here are the DAC fields. I think they look perfect, but maybe I’ve been staring at this too long.
#region QtyLessThan
rPXDBDecimal()]
>PXUIField(DisplayName = "Quantity Less Than")]
public virtual Decimal? QtyLessThan { get; set; }
public abstract class qtyLessThan : PX.Data.BQL.BqlDecimal.Field<qtyLessThan> { }
#endregion
#region PickMedium
#PXDBInt]
mPXUIField(DisplayName = "SO Line Count Greater Than")]
public virtual int? PickMedium { get; set; }
public abstract class pickMedium : PX.Data.BQL.BqlInt.Field<pickMedium> { }
#endregion
This is baffling me.