Problem with picklist inside a subform

Problem with picklist inside a subform

Hi,

We have an Order form and inside it – an Order_Item form. It has two dropdowns, Category and Items. A change in Category is supposed to repopulate the Items dropdown. I'm using the following code, which generates weird errors:

  1.            if (count(Products[Category ==row.Category])  ==  0)
  2.             {
  3.                 clear row.Items;
  4.             }
  5.             else
  6.             {
  7.                 itemlist  =  Products  [Category ==row.Category] sort by  Product ;
  8.                 row.Items:ui.add(itemlist.Product.getall());
  9.             }

I'm getting the following error:

The field Items is not present in the form null

Why?