"Improper Statement" Error on Deluge Loops (while/for) when Processing a Date Range

"Improper Statement" Error on Deluge Loops (while/for) when Processing a Date Range

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!


      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ



                                ご検討中の方