AnsweredAssumed Answered

Exit Loop If Issue

Question asked by wkparkjoe on Feb 24, 2011
Latest reply on Feb 24, 2011 by wkparkjoe

Title

Exit Loop If Issue

Post

Hello,

I have the following in a script.

# Clear Quantity
Set Variable [ $RepNum; Value:0 ]
Set Variable [ $MaxRep; Value:Count ( Large PO Form::Quantity ) ]
Loop
   Set Variable [ $RepNum; Value:$RepNum + 1 ]
   Exit Loop If [ GetAsNumber ( $RemNum ) > GetAsNumber ( $MaxRep ) ]
   If [ not IsEmpty ( Large PO Form::Quantity[$RepNum] ) ]
      Set Field [ Large PO Form::Quantity[$RepNum]; "" ]
   End If
End Loop

The idea here is that I have fields I want to blank out. The field above is a 20 repetition field. Based on the logic I'm using, if there are 3 repetitions in the field Quantity, then after the 3rd repetition, exit the loop and move on in the script. However, the script logic above will continue past the condition of the Exit Loop If until it errors out when the field repetition is greater than the max number of repetition (error 111). Any suggestions on why the Exit Loop condition isn't working?

Outcomes