Distor4by
Distor4by

Reputation: 109

Acumatica Calculate Unbound Field

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

Answers (2)

Distor4by
Distor4by

Reputation: 109

finnaly i'm using PXDBScalar and it's works on unbound field.

Upvotes: 2

samol518
samol518

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

Related Questions