Error with for each record- update records script

Error with for each record- update records script

Hi,

I've entered this script into the form "Orders"

  1. for each z in Clients
  2. {
  3.     z.Monthly_Spend = Orders[((z.Client_ID in Clients && Month == zoho.currentdate.getMonth()) && Year == zoho.currentdate.getYear())].sum(Order_Cost) ;
  4.     z.Year_to_Date_Spend = Orders[(z.Client_ID in Clients && Year == zoho.currentdate.getYear())].sum(Order_Cost) ;

and I get Error at line:3
Field Monthly_Spend does not exist in the form Orders

This is true- Monthly_Spend is not in the form Orders- but it's supposed to be updated in form Clients! Why am I getting this error, and what should I do to get around it?

Thanks very much, appreciate your help.

Navid