Skip to main content

Hi All,

 

In the code snippet below, how do I access the value for the field TranCost? I can’t get to it using row.tranCost. This is on the screen PO303000.

 

        protected void POLandedCostReceiptLine_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
        {
            var row = (POLandedCostReceiptLine)e.Row;

        }

 

When I use row.tranCost I get the following error:

 

\App_RuntimeCode\POLandedCostDocEntry.cs(220): error CS1061: 'object' does not contain a definition for 'tranCost' and no accessible extension method 'tranCost' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

 

Maybe I just have the field name wrong. I am trying to get to the Extended Cost amount for the line. I tried inspecting but I am not able to because the grid is not editable so I always only get the details for the whole grid and not the column I click on. I looked at the table in the database and the field is named TranCost.

I think you’re looking for row.TranCost.  The capitalized property is the field value.


Tried that. Same result.


Can you show us more code?


Hi @abbas56  We do not have TranCost field in POLandedCostReceiptLine DAC, hence you are getting that issue.

Can you please let me know from screen (Screenshot), which field you are trying to get the value. 

 


@abbas56  Below is the code to fetch the Extended Cost field value from POLandedCostReceiptLine DAC.

 

LineAmt is the DAC field name, and Ext Cost is the UI name.

 

  public class POLandedCostDocEntryExt : PXGraphExtension<POLandedCostDocEntry>
{
protected void POLandedCostReceiptLine_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
{
POLandedCostReceiptLine row = (POLandedCostReceiptLine)e.Row;
if (row != null)
{
var ExtendedCost = row.LineAmt;
}

}
}

 


Thanks Naveen. I'll try that out and report back. Is there a resource website that lists all the fields available in a DAC?

 

Regards,

Abbas


Yes @abbas56 You can see all the DAC field names with the below steps.

  • Inspect the Element on the Grid
  • Click on the Actions and then click on the View Data Class Source.

Please find the screenshot for reference.

 


Thank you Naveen. Your information really helped and resolved my issue.

 

 


That is wonderful.. Thanks for sharing an update :)


Reply