Quantcast
Channel: aras PLM community
Viewing all articles
Browse latest Browse all 1103

Problem ehile onBeforeUpdate event

$
0
0

Hello all,

I am not able to run this code onBeforeUpdate event..

I want to add total cost of items in FM_FORMULABOM and show that Total in textBox of fm_cost..

 

Innovator inn = this.getInnovator();

string sFormulaId = this.getProperty("id");
//return inn.newError(sFormulaId.ToString());
Item fmbom = inn.newItem("FM_FORMULABOM","get");
fmbom.setAttribute("select","related_id");
fmbom.setAttribute("where","source_id = ' " + sFormulaId+ "  ' ");
Item result =fmbom.apply();
return inn.newError(result.ToString());
int count = result.getItemCount();
return inn.newError(count.ToString());
decimal total = 0 ;
for( int i = 0 ; i<count ; i++)
{
    Item bom = result.getItemByIndex(i);
    Item bompart = bom.getRelatedItem();
    string sCost= bompart.getProperty("cost");
    if( sCost != null )
    {
        total = total + Convert.ToDecimal(sCost);
       
    }
}
this.setProperty("fm_cost", Total.ToString());
return inn.newError(total.ToString());
return this;

 

Please help me..


Viewing all articles
Browse latest Browse all 1103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>