Zoho gives an error inside conditional

Zoho gives an error inside conditional


I'm trying to count the number of instances of a particular variable, then if the count is above 0, add that variable name to a field.  Here is the code:



      for each account in Accounts
        {
            account_name = account.Client_Name;
            account_count = count(Projects[Project_Status == "Open" && Project_Type == "Chargeable" && "Account" == account_name]);
            if (account_count  !=  0)
            {
                Account:ui.add(account.Client_Name);
            }
        }



If i try to run this code, I get this error:

"Either the left or the right expression in a boolean expression in the criteria has to be a Form/Table Variable"

If I change the code to remove the account_name variable and compare directly to account.Client_Name, as shown below:


  for each account in Accounts
        {
            account_count = count(Projects[Project_Status == "Open" && Project_Type == "Chargeable" && "Account" == account_name && "Account" == account.Client_Name]);
            if (account_count  !=  0)
            {
                Account:ui.add(account.Client_Name);
            }
        }



Then it allows me to save, but I get this error when running the form:

Error details:
Error occured while executing on user input script.
Unable to update variable
Error occured
I know that it's the account name comparison that's throwing the error, because i've omitted the other two comparisons on that line and the script runs fine.  This is driving me a little crazy - am I doing something wrong or does anyone have a workaround?

Thank you!