0

I have a need to override the Select statement being used for the SOShipmentPlan PXProjection/DAC, namely, removing the

And <INPlanType.isFixed, Equal<boolFalse> condition.

I can override all of the CreateShipment() logic and bring in any other necessary routines into an SOShipmentEntry_Extension class, to the point where I finally can use my own version of a SOShipmentPlan class, but that all seems needlessly complex when all I want to do is override the select for the PXProjection attribute. Overriding CreateShipment() and supporting routines also seems like a quick way to get in trouble come time for upgrades.

So, is there an easy way to override the PXProjection's BQL, or am I stuck overriding all kinds of code?

UPDATE 1

Based on a link provided below (stackoverflow.com/a/41540659/7376238), I feel like I'm close. Here's the block of code I end up with:

namespace PX.Objects.SO
{
  public class SOShipmentEntry_Extension : PXGraphExtension<SOShipmentEntry>
  {
    #region Event Handlers

    #endregion

    [Serializable]
    [PXProjection(typeof(Select2<SOOrder,
      InnerJoin<SOOrderType, On<SOOrder.FK.OrderType>,
      InnerJoin<INItemPlan, On<INItemPlan.refNoteID, Equal<SOOrder.noteID>>,
      InnerJoin<INPlanType, On<INItemPlan.FK.PlanType>>>>,
    Where<INItemPlan.hold, Equal<boolFalse>,
      And<INItemPlan.planQty, Greater<decimal0>,
      And<INPlanType.isDemand, Equal<boolTrue>,
      And<INPlanType.isForDate, Equal<boolTrue>,
      And<Where<INItemPlan.fixedSource, IsNull, 
        Or<INItemPlan.fixedSource, NotEqual<INReplenishmentSource.transfer>>>>>>>>>))]
    [PXSubstitute()]
    public partial class SOShipmentPlanCst : SOShipmentPlan
    {
      int x = 0;
    }
}

But it doesn't seem to work. Not sure of where I'm supposed to put the code. I've tried putting the class definition inside and outside of public class SOShipmentEntry_Extension : PXGraphExtension<SOShipmentEntry> class (currently inside the extension class as shown). No luck either way.

Jerry Kurtz
  • 112
  • 7

1 Answers1

1

THIS ANSWER DIDN'T WORK

Fair warning... I have not done this to a PXProjection before, so you'll have to see if this works. The nature of extensions tends to allow overriding views by simply redefining them. I have not done this myself with a projection, but I suspect it will be similar. Give it a try and see if you get the desired results. All I can say about testing it is that "it compiled" when I added to my project and removed the INItemPLanType.isFixed condition.

public class SOShipmentEntry_Extension : PXGraphExtension<SOShipmentEntry>
{
    [PXProjection(typeof(Select2<SOOrder,
        InnerJoin<SOOrderType, On<SOOrder.FK.OrderType>,
        InnerJoin<INItemPlan, On<INItemPlan.refNoteID, Equal<SOOrder.noteID>>,
        InnerJoin<INPlanType, On<INItemPlan.FK.PlanType>>>>,
        Where<INItemPlan.hold, Equal<boolFalse>,
        And<INItemPlan.planQty, Greater<decimal0>,
        And<INPlanType.isDemand, Equal<boolTrue>,
        And<INPlanType.isForDate, Equal<boolTrue>,
        And<Where<INItemPlan.fixedSource, IsNull, Or<INItemPlan.fixedSource, NotEqual<INReplenishmentSource.transfer>>>>>>>>>))]
    public partial class SOShipmentPlan : IBqlTable { }
}
Jerry Kurtz
  • 112
  • 7
Brian Stevens
  • 1,826
  • 1
  • 7
  • 16
  • 1
    It's always a good bet to try copy pasting first to override. If that doesn't work out, there's a more convoluted solution here as well: https://stackoverflow.com/a/41540659/7376238 – Hugues Beauséjour Mar 09 '20 at 20:38
  • I actually have tried the above code snippet, both inside and outside of ```SOShipmentEntry_Extension``` class, but that didn't work. The SF you linked to looks promising, but I can't quite figure out how to get it to work. I'll update my question with the code that results from attempting the SF link you supplied. – Jerry Kurtz Mar 09 '20 at 21:41