After an excessive amount of head scratching, I finally came up with a simple fix that allows two or more of Gary’s procedures to be used in sequence. The problem I had was that my own code included a loop which collided with the loop in Gary’s gettext procedure. The fix was to add a goto. Here’s the simplest of my modified procedures:
// User inputs an item number, saves it in a variable, then does the same for the quantity needed:
startOver: // the goto label
local theSearchTerm,thePrompt
theSearchTerm=“11-XXX”
thePrompt=“Enter the full item number.”
call .gettextsheet,thePrompt,theSearchTerm //the first call to Gary’s procedure
Loop
Select ItemNum MATCH theSearchTerm
if theSearchTerm=""
AlertNoYes "You did not enter a search term. Would you like to stop searching?"
Repeatloopif info("DialogTrigger") contains "No"
STOP
endif
if ItemNum NOTMATCH theSearchTerm
AlertYesNo "I didn't find any items matching your term; try again?"
Repeatloopif info("DialogTrigger") contains "Yes"
STOP
endif
// Now get the quantity requested:
local theQuantity,thePrompt
theQuantity=“1”
thePrompt=“How many?”
call .gettextsheet,thePrompt,theQuantity //Second call to Gary’s gettext procedure
// Data in the two variables is now stored in the database for later use:
Field QO_ItemNum
Fill theSearchTerm
Field QO_QTY
Fill theQuantity
goto startOver: // Take user back to the top so that the data entry repeats without interruption and without
// needing to click
while forever
==========================
Without the goto, the loop in Gary’s procedure got stuck on the second (quantity) prompt and never took the user back to the top.
Thanks thanks thanks especially to Gary!
b