1 Reply Latest reply on Apr 29, 2010 1:41 PM by philmodjunk

    Proper use of Loops

    jconner99

      Title

      Proper use of Loops

      Post

      I am writing a script for a user to enter certain data in a field. I have decided to use a custom dialog box for the data entry. I am having trouble matching my workflow, which is as follows:

       

      1. Click a button to input data

      2. Dialog box appears

      3. Enter the data and click OK

      4. Data is entered into the appropriate field

       

      Two conditions need to happen to complete the workflow

      1. The data input cannot be blank

      2. The data input is constrained to specific information-

       

      Here is my script so far:

       

      #open a dilalog box with the required fields

      1.Show Custom Dialog (instruct to enter the appropriate data and provide input fields)

      #Require the field is populated

      2.If [IsEmpty (Specific field)

          3.Show Custom Dialog (explaining the rquirement and providing the input field)

      4.Else If (the field data doesnt meet the requirement)

          5.Show  Custom Dialog box (explaininf the data is wrong and prodiving an input field to enter it correctly)

      6.End if

       

      Here is my problem; at step 5 if the user still puts in the wrong data the script ends and the incorrect data is entered. I think I need a loop can't can't figure out how to place it

        • 1. Re: Proper use of Loops
          philmodjunk

          Loop

            Show Custom Dialog [//specify your input fields here]

            If [IsEmpty ( SpecifiedField ) ]

                Show Custom Dialog[]

            Else IF [ //Check range here]

               Show Custom Dialog

            End IF

            Exit Loop If [Not IsEmpty (specifiedField) and //Check range here]

          EndLoop

           

          You could also use New WIndow to pop up a small window with field formatting/validation to catch the same errors. It takes more work and is a bit clunky in one or two details, but can be more user friendly due to formatted/validated fields.