How can i update BOM table
How can i update value in BOM table by using groovy script.
I tried below script to update but its not working.
obj.setValueByAttId(ItemConstants.ATT_BOM_BOM_NUMERIC03,”3″);
Please let me know how can i update..
Thanks in Advance…
You can try something like this.
ITable affTable= item.getTable(ItemConstants.TABLE_BOM);
Iterator it1=affTable.iterator();
while(it1.hasNext())
{
IRow row=(IRow) it1.next();
ICell cell = row.getCell(ItemConstants.ATT_BOM_REF_DES);
System.out.println(“The Ref Des is: ” + cell.getValue().toString());
cell.setValue(“Test11”);
}
}
It worked for me.
ITable affTable= item.getTable(ItemConstants.TABLE_BOM);
Iterator it1=affTable.iterator();
while(it1.hasNext())
{
IRow row=(IRow) it1.next();
ICell cell = row.getCell(ItemConstants.ATT_BOM_BOM_TEXT01);
def v2 = row.getCell(ItemConstants.ATT_BOM_BOM_NUMERIC01).toDouble();
v3 = (v1.multiply(v2)).toString();
cell.setValue(v3);
}
In above code when i define
def v2 = obj.getValueByAttId(ItemConstants.ATT_BOM_BOM_NUMERIC01).toDouble();
It fetches the value from last bom Table and performing multiplication.
when using def v2 = row.getCell(ItemConstants.ATT_BOM_BOM_NUMERIC01).toDouble();
We are getting bellow exception.
No signature of method: com.agile.api.pc.CellRedlined.toDouble() is applicable for argument types: () values: {}
Please help me how can i fix this.
Thanks in Advance……