1
votes

I am trying to make the ShippedQty readonly based on a new status I created as a custom field in the SOShipment row. I need to get the SOShipment record in the SOShipLine_RowSelected event, but the PXSelect keeps giving me an error. Please see my code below:

    protected virtual void SOShipLine_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
    {
        SOShipLine soShipLine = (SOShipLine)e.Row;
        if (soShipLine != null)
        {
            SOShipment soShipment = PXSelect<SOShipment,
                        Where<SOShipment.shipmentNbr, Equal<Required<SOShipment.shipmentNbr>>>>.Select(this, soShipLine.ShipmentNbr);
            var soShipmentExt = PXCache<SOShipment>.GetExtension<SOShipmentExt>(soShipment);

            if (soShipment.Status == "N" && soShipmentExt.UsrEDIStatus != "N")
            {
                PXUIFieldAttribute.SetEnabled<SOShipLine.shippedQty>(sender, e.Row, Base.IsImport);
            }
        }

I am getting the error: CS0120 An object reference is required for the non-static field, method, or property 'PXSelectBase.Select(params object[])'

Anyone have any idea why? I have used this type of select many places. I think it is having issue with the soShipLine.ShipmentNbr parameter in the Select.

1

1 Answers

2
votes

The "this" variable in your function is an instance of PXGraphExtension, not PXGraph. You can get the graph by passing "Base" (with capital B) to the Select function.

I would caution against selects in the RowSelected event since it can significantly decrease performance of the screen. In this case, you're trying to get information from the current shipment, which you could also retrieve from Base as well (Base.Document.Current variable).