Hello, Zoho Community,
I'm facing a very specific issue with a Deluge script and would appreciate any insights from the community.
The Goal:
I have a form (ausencia_visitadoras) where a user inputs a start date and an end date for a period of absence. On submit, a Deluge script should create multiple records in a second form (Registro_Diario_Ausencia), one for each day within the specified date range.
The Setup:
Input Form (ausencia_visitadoras):
data_inicio (Type: Date)
data_fim (Type: Date)
Destination Form (Registro_Diario_Ausencia):
Data_Ausencia (Type: Date)
The Problem:
Every attempt to use a programmatic loop (while or for i from 0 to X) to iterate through the days of the range fails. I get the error "Improper Statement" on the exact line where the loop is declared, and the script fails to save.
What I've Already Ruled Out:
The loop syntax is correct (no stray semicolons, correct brace placement, etc.).
The Field Link Names (data_inicio, data_fim) are correct in the script.
The code has been adjusted to use addDays(1) since the fields are Date-Time.
The strange part: A for each loop that iterates over fetched records works perfectly fine in another part of the same application. The issue seems specific to programmatic loops (while with a condition or for with a numeric counter) in this context.
My Question:
Has anyone encountered a similar "Improper Statement" error that seems tied to date/time manipulation or counters within while/for loops? Is there an alternative approach to generating records from a date range that might bypass this apparent Deluge parsing issue?
Any help or ideas would be greatly appreciated!