Skip to main content
Solved

Code Question: Get value of field from grid


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.

Best answer by Naveen Boga

@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;
            }

        }
    }

 

View original
Did this topic help you find an answer to your question?

Forum|alt.badge.img+6
  • Captain II
  • July 6, 2021

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


  • Freshman I
  • July 6, 2021

Tried that. Same result.


Forum|alt.badge.img+6
  • Captain II
  • July 6, 2021

Can you show us more code?


Naveen Boga
Captain II
Forum|alt.badge.img+19

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. 

 


Naveen Boga
Captain II
Forum|alt.badge.img+19

@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;
            }

        }
    }

 


  • Freshman I
  • July 6, 2021

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


Naveen Boga
Captain II
Forum|alt.badge.img+19

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.

 


  • Freshman I
  • July 6, 2021

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

 

 


Naveen Boga
Captain II
Forum|alt.badge.img+19

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings