Zoho Creator get records from SubForm error

Zoho Creator get records from SubForm error

Hello, I'm making an app in Zoho Creator. I have one problem with SubForms.
The app is like this: 

I have one Main form, with SubForm in it.

I have a html view where I load one record.

rec = Main_Form [ID = input.ID.toLong()];

Now "rec" holds all the fields from the main form.
What is the correct way to iterate though the fields in the SubForm.

When I try this:

subform = rec.Sub_form;

I get this error:


Form does not exist - ZC_SUBFORM_9

What I want to do is make a for each of the fields in the subform. Something like that:

rec = Main_Form [ID = input.ID.toLong()];
subform = rec.Sub_form;
for each subRec in  subform  
{
      // get  subRec.Title;
}