Using dropdown append and add functions on a dropdown field inside a dynamically generated subform row

Using dropdown append and add functions on a dropdown field inside a dynamically generated subform row

Greetings

i'm working on a subform where i will create rows dynamically and assign them values on form load. i also want to assign choices dynamically to the dropdown menus of each generated row.

the issue is when i try to access the :ui of the dynamically generated row i get that the row name variable i'm using is null! despite that i was using it in the previous line with no issues!

here is how my code looks, what can i do to achieve what i need?


  1. row1 = Add_Employee.Earnings();
  2. x = New_Earning[Earning_Type == id];
  3. row1.SALARY_COMPONENTS=x.ID;

  4. ear_typ = New_Earning[ID == row1.SALARY_COMPONENTS].Earning_Type;
  5.         //i try here to add the choices list to the dropdown component
  6. row1.COMPONENTS_DROPDOWN:ui.add(New_Earning[Earning_Type == ear_typ].ID.getAll());

  7.        if(x.Calculation_Type == "Flat Amount")
  8. {
  9. row1.MONTHLY_AMOUNT=x.Enter_Amount;
  10. row1.ANNUAL_AMOUNT=x.Enter_Amount * 12;
  11. row1.Calculation_Type="Fixed amount";
  12. }
  13. else
  14. {
  15. row1.Calculation_Type=x.Percentage + " %";
  16. }
  17.         //everything else works correctly and i can successfully assign values to dynamic fields
  18. input.Earnings.insert(row1);

thanks