Writing form code using a foreach loop
Hi,
I am quite new to Zoho Creator and am only a hobby coder. Maybe someone can tell me if I can do what I intended to and how...
I am trying to do the following: I have a normal form and a stateless form. In the normal form I have several jobs, with job id, job status, job assigned to etc.
In the stateless form a user can select in a pulldown menu his name and then he should get a list of all jobs that are currently assigned to him. This can beo none, just one or several jobs at once...
on user input
{
i=1;
for each x in Create_New_Jobs [Assigned_to == input.user] sort by Job_ID
{
Job_ID + i
(
displayname = "Job ID" + " " + i
type = number
width = 20
)
Job_Type + i
(
displayname = "Job Type" + " " + i
type = text
)
Created_by + 1
(
displayname = "Created by" + " " + i
type = text
)
Job_Describtion + i
(
displayname = "Job Describtion" + " " + i
type = textarea
)
input.Job_ID + i = x.Job_ID;
input.Job_Type + i = x.Job_Type;
input.Created_by + i = x.Created_by;
input.Job_Describtion + i = x.Job_Describtion;
i++;
}
Unfortunately this code doesnt run it always stops with an error here: Job_ID + i
Saying for, if, ... expected.
Is there a way to create form code when using an on user input script? If thus how? Or is there another way to list specific entires from one form in a stateless form upon user input?
Thanks for your help.
- Fox