End Labor Activity quantity

I would like to assign the labor quantity to a variable. I know that the EpiBinding is End.LaborQty (or End.DiscrepQty for non-conformed parts), but not sure on the syntax of assigning that to a variable in C#.

I tried this, but do I need to cast it as a float?

object LaborQty = this.oTrans.EpiDataViews["End.DiscrepQty"];
MessageBox.Show(string.Format("Quantity = {0}",LaborQty));

decimal LaborQty = ((decimal)this.oTrans.EpiDataViews[“End.DiscrepQty”]);
MessageBox.Show(string.Format(“Quantity = {0}”,LaborQty));

I get the “object reference not set to an instance of an object” error when I try to end activity.

Oh lol, yea cuz End.DiscrepQty isnt an EDV. End is.

do this:

var edvEnd =  oTrans.Factory("End");  
if(edvEnd != null)
{
decimal LaborQty = ((decimal)edvEnd.dataView[edvEnd.Row]["DiscrepQty"]);
MessageBox.Show(string.Format(“Quantity = {0}”,LaborQty));
}


Hmmmm…seems like we’re nearly there.

Error: CS0021 - line 158 (381) - Cannot apply indexing with [] to an expression of type 'Ice.Lib.Framework.EpiDataView'

i didnt reference the current row, see above

Yup, I missed a bit of the code! It works now. Thank you!