tolson

Loop Fault

Discussion created by tolson on Feb 22, 2017
Latest reply on Feb 22, 2017 by philmodjunk

I'm getting stuck in a loop until I hit the "esc" key.

 

I have a button on a main menu that triggers a script.

The script opens a layout, performs a find and goes to the first record in the set.

It then loops to evaluate contents of a field.

The field just tracks which records have been used and which have not. Each time a person views and uses the record, a "1" is put in this field by clicking a button which also advances them to the next record. If they wish to escape to the main menu, they can do so, but the next time they enter this category I want them only to find the unviewed records.

There is another field that counts the "1"s in the first field; when this field equals 6 (the total number of found records, it dumps back out to the main menu.

It all works fine EXCEPT when I run the script, it gives me a blinking "ESC" message. When I press "ESC" the layout comes up and everything works perfectly.

Here's the script:

 

Go to layout ["Round 1 News" tblTWQuestions)]

Perform Find [Restore]  - this pulls up the specific records by category and "round"

Go to Record/Request/Page [First]

Loop

     Set Field [tblTWQuestions::NewsUse] - this is the "tally" field that records a "1" if the question has been used

     If [tblTWQuestins::NewsUse = 1]

          go to Record/Request/Page {Next; Exit after last]

     End If

End Loop

 

This script is just to get the proper records into the layout - those that only have "1" in the "NewsUse" field.

 

As I said it works after I hit "esc"; I had inserted a "halt script" command after the End If, but it didn't pull up the correct records.

 

I went to post this in the "beginner's forum" but it won't let me post a new discussion and looks to be abandoned.

Outcomes