How to restrict repeated values in a lookfield of subform

How to restrict repeated values in a lookfield of subform

Hi,

      I have a subform with 2 fields "Color" and "Thickness"(These 2 are lookup to fields in other form say F1).

      Now if i select one Color, all corresponding Thickness to that Color has to be displayed for 1 time.

      Say like, if you have records like       Black - 3cm
                                                            Black - 3cm
                                                            Black - 3cm
                                                            White - 2cm
                                                            White - 2cm
                                                            Black - 2cm
                                                            Black - 2cm

      So, if i select Black Color in lookup, that has to show like      3cm
                                                                                               2cm


      But for the following Code it is giving output like      3cm
                                                                                3cm
                                                                                3cm
                                                                                2cm
                                                                                2cm

      I wrote this code in Subform field "Color". 
      Say F1 is having original fields "Color" and "Thickness" to those lookups in subform

  1. clear row.Thickness;
  2. Thickness_List = List();
  3. for each rec in F1 [Color == row.Color]
  4. {
  5. if(!Thickness_List.contains(rec.Thickness))
  6. {
  7. Thickness_List.add(rec.Thickness);
  8. row.Thickness:ui.append(rec.Thickness);
  9. }
  10. }

      Regards,
      kmkr :)