selected_vendor = input.Vendor_lookup;
selected_item = input.Line_Items.Items_order;
list_a = list();
list_b = list();
i = 0;
//...............................................................
x = Materials_Form[ID == selected_item].Vendors_subform;
for each y in x
{
list_a.add(y);
list_value = list_a.get(i);
list_b.add(list_value);
i = i + 1;
chosen_item = Materials_Form[ID = y];
vendor_id = y.Vendors_ID;
if(vendor_id == selected_vendor)
{
vendor_product_ID = y.ID;
vendor_code = y.Vendor_Code;
vendor_description = y.Vendor_Description;
vendor_price = y.Vendor_Cost_per_Unit;
}
}
row.Vendor_Product_Description=vendor_description;
row.Vendor_Code=vendor_code;
row.Cost=vendor_price;
This code produces a correct result for the first line item, but new line items for the same vendor duplicate the first line item vendor descriptive details even though the lookup field is pointing to a different product. The second line quantity to total formula doesn't run. Screenshots are available.