hi ,
I am unable to get values that I am having to a relationship grid of parent item on the client side.
I have written this on a onClick event on the property. i am able to set source id and related id of item type, but after that unable to make relationship with next item type . related id and last item type id are same.
I am having cost as field in FM_Itemtype and doing their total of it in total cost in FM_formula item type using field event.
I tried various ideas but cant getting success
Please help ..
here is my code
*********************************************************
innovator = document.thisItem.getInnovator();
var vFormula = innovator.newItem("FM_Formula","get");
var vFormulaId=document.thisItem.getProperty("id");
vFormula.setAttribute("where", "[FM_Formula].id='" + vFormulaId + "'");
vFormula.setID(vFormulaId);
var vFormulaBom = vFormula.newItem("FM_FORMULABOM","get");
vFormulaBom.setAttribute("select", "source_id");
vFormulaBom.setAttribute("select", "related_id");
var vItem = vFormula.newItem("FM_ITEM","get");
vItem.setAttribute("select", "id, cost");
vFormulaBom.setRelatedItem(vItem);
vFormula.addRelationship(vFormulaBom);
var results = vFormula.apply();
var count = results.getItemCount();
alert(count);
var v=0;
for (var i=0; i<count; i++)
{
var vIndexitem = results.getItemByIndex(i);
var vItem=vItem.getRelatedItem();
var vCost = vIndexitem.getProperty("cost");
if (vCost)
{
v=parseFloat(v) + parseFloat(vCost);
}
alert(vCost);
}
handleItemChange("total_cost", v);