Question
· Oct 7, 2017

Specific value for READ command

 how to set some specific value for the variable if the user enter that specific value then only it will go to next step  

Discussion (1)0
Log in or sign up to continue

Compare what user entered to the specific value. If they mismatch  - ask again. Also there are several utility methods in %Prompt class for number/yes-no/etc input:

  • GetNumber
  • GetString
  • GetYesNo
  • GetArray - Prompt for a number or entry in a displayed menu. Returns the selected item.
  • GetMenu - Prompt for a number in a displayed menu.
  • GetMore - Prompt for More or Quit.

For example:

do ##class(%Prompt).GetYesNo("Enter Yes or No:", .result)

User can input only Yes (Y) or No (N). result variable would hold 1 or 0.

You can also check %Prompt code and write something based on that.