populating one subform data to same subform on next count

populating one subform data to same subform on next count

hi all,


I have a form (Inwards) in which there is subform (remaining items on P.O).
forget count 0 plz
on count 1, subform add row i have populated count 0 data to subform which is working nicely
on 2nd count, subform add row i want to populate (remaining items on P.O) to same form.
i am using this script for 1st and 2nd count
  1. if(Inwards[Purchase_Order_Number == input.Purchase_Order_Number && Field_field == "Open"].count() = 1 )
  2. {
  3. rec = inward_items_lookup[Inwards == input.Inward_Number];
  4. i = 0;
  5. a = List();
  6. b = List:Int();
  7. c = List:Int();
  8. d = List:Int();
  9. e = List:Int();
  10. f = List:Int();
  11. get_sf_values = Inwards[Inward_Number == Inward_Number].Items_Received;
  12. for each  rec in get_sf_values
  13. {
  14. a.add(rec.Item4);
  15. b.add(rec.UOM4);
  16. c.add(rec.Rate_Unit4);
  17. d.add(rec.Remaining_Quantity1);
  18. e.add(rec.Department_and_cost_center);
  19. f.add(rec.Job_ID);
  20. }
  21. for each  rec1 in Remaining_Items_on_P_O
  22. {
  23. if(a.size() > i)
  24. {
  25. rec1.Item9=a.get(i);
  26. rec1.UOM9=b.get(i).toString();
  27. rec1.Rate_Unit9=c.get(i);
  28. rec1.Remaining_Quantity9=d.get(i);
  29. rec1.Department_with_cost_centers9=e.get(i);
  30. rec1.Job_ID=f.get(i);
  31. }
  32. i = i + 1;
  33. }
  34. }
  35. if(Inwards[Purchase_Order_Number == input.Purchase_Order_Number].count() = 2)
  36. {
  37. rec3 = Remaining_items_inward_lookup_for_open_PO[Inwards == input.Inward_Number];
  38. i = 0;
  39. a = List();
  40. b = List:Int();
  41. c = List:Int();
  42. d = List:Int();
  43. e = List:Int();
  44. f = List:Int();
  45. get_sf_values = Inwards[Inward_Number == Inward_Number].Remaining_Items_on_P_O;
  46. for each  rec3 in get_sf_values
  47. {
  48. a.add(rec3.Item9);
  49. b.add(rec3.UOM9);
  50. c.add(rec3.Rate_Unit9);
  51. d.add(rec3.further_remaining);
  52. e.add(rec3.Department_with_cost_centers9);
  53. f.add(rec3.Job_ID);
  54. }
  55. for each  rec4 in Remaining_Items_on_P_O
  56. {
  57. if(a.size() > i)
  58. {
  59. rec4.Item9=a.get(i);
  60. rec4.UOM9=b.get(i).toString();
  61. rec4.Rate_Unit9=c.get(i);
  62. rec4.Remaining_Quantity9=d.get(i);
  63. rec4.Department_with_cost_centers9=e.get(i);
  64. rec4.Job_ID=f.get(i);
  65. }
  66. i = i + 1;
  67. }
  68. }
there is an error on 2nd count saying  Error occurred while executing on add row script.

please help