No announcement yet.

Loop gives error

  • Filter
  • Time
  • Show
Clear All
new posts

  • Loop gives error

    Below is some code from a page of mine and when it is first launched it will populate the answers into the appropriate text objects, but the loop will give me an error. It works just fine but the loop always complains. I have disabled the error reporting on the While statement and now I don't get an error. I have similar code on the NEXT button for this page and the loop works great, with error reporting turned on. I am lost as to why it does this.

    IF (%Review% = TRUE)
    GOTO ("populate")
    END IF
    // Get the number of files that match the search
    %NumFiles% = GlobalList[Selected Answers].GetProperty ("Item Count")
    Page.HideObject ("Back")

    // Set the Page Number
    %PageNum% = Evaluate (1)

    // Set the first Links Number. This is used to put the correct text into the link
    // %LinkCtr% = Evaluate (0)

    // Get the first 4 questions
    %LinkCtr% = Evaluate (4 * (%PageNum%-1))
    %MaxLink% = Evaluate (((4 * %PageNum%) -1))
    WHILE (%LinkCtr% <= %MaxLink%)
    %LinkNum% = Evaluate (%LinkCtr% - (4 * (%PageNum% -1)))
    %ListItem% = GlobalList[Selected Answers].GetItem (%LinkCtr%)
    // WHILE (%LinkNum% <= 3)
    // %ListItem% = GlobalList[Selected Answers].GetItem (%LinkNum%)
    %Question% = String.GetDelimitedString ("%ListItem%", ";;", 0)
    %Answer% = String.GetDelimitedString ("%ListItem%", ";;", 1)
    IF (%LinkText% != "")
    TextObject[Q%LinkNum%].SetText ("%Question%")
    Page.ShowObject ("Q%LinkNum%")
    TextObject[A%LinkNum%].SetText ("%Answer%")
    Page.ShowObject ("A%LinkNum%")
    Page.HideObject ("Q%LinkNum%")
    Page.HideObject ("A%LinkNum%")
    END IF
    %LinkCtr% = Evaluate (%LinkCtr%+1)
    IF (%NumFiles% > 4)
    Page.ShowObject ("Next")
    END IF

    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine