Dynamically adding items to a picklist

Dynamically adding items to a picklist

Hello,

We are planning to migrate our data from dabble to zoho.  Im still new and studying the features here. I'm testing and following instructions from the help topic:   shows you how to build an application with dynamic picklist, with the help of an example. 

This is my case: select a "Program" from the Program list, only the activities belonging to the selected program must be dynamically displayed in the activties list .

I constructed the script below and pasted it in the free flow script editor:

Program
        (
            type  =  picklist
            values  =  Program.Program_Name
            sortorder  =  ascending
            on user input
            {
                if (count(Activities[Program_Name == input.Program])  ==  0)
                {
                    clear Activities;
                }
                else
                {
                    activitieslist  =  Activities  [Program_Name == input.Program] sort by  Activity_Name ;
                    Activities:ui.add(activitieslist.Activity_Name.getall());
                }

            }
        )

Problem: When I save the script a message appear: 
Encountered "values" at line 4, column 13.
Was expecting one of:
"," ...

")" ... 

I could not figure out where's the fault. I followed initimately the steps in the tutorial instruction.  Im not a coder.  Please help.

Edith