Reputation: 109
i some problems about calculate unbound field, i want get value from grid by row index like RowIndex property in c#, is it available from acumatica?
protected virtual void BSMTActivityTypePlanDetail_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
if(e.Row == null)
{
return;
}
BSMTActivityTypePlan head = new BSMTActivityTypePlan();
BSMTActivityTypePlanDetail detail = (BSMTActivityTypePlanDetail)e.Row;
for (int x = 0; x <= DetailActTypePlans.Select().RowCount; x++)
{
head.TotalPlanAct += DetailActTypePlans.
}
}
What could be the correct way to solve this problem? thanks
Upvotes: 0
Views: 1195
Reputation: 1404
I see 2 possible ways of arriving at a possible solution:
The first one is closer to what you would have liked to achieve: to use “foreach” instead of “for”:
foreach (DetailType detail in DetailView.Select())
{
head.TotalPlanAct += detail.PlanActValue;
}
The other one would be to use a view
with an aggregate, so that it would directly return you the total value and you won’t have to loop in your code to calculate it.
Upvotes: 3