(Warning Dialog Script) SET WarningDialogText-t TO WarningDialogText-t // This makes the text uneditable, so that the user can't change anything. (Computation) "" SET Mistake-b TO UNANSWERED ASK Dialog IF Variable = "Some bad value" SET Warning-t TO "Your answer was: «Variable». This is not recommended.\r\r-\To-t keep this answer, click NEXT\r-\To-t change your answer, please select MISTAKE" ASK WarningDialog END IF IF Mistake-b ThisComputation // Substitute with the name of this computation END IF Example: SET WarningDialogMistake-b TO UNANSWERED SET MainDialogSubTotal-n TO UNANSWERED ASK MainDialog SET MainDialogSubTotal-n TO SUM( Loan-n ) IF MainDialogSubTotal-n != LoanAmount-n SET WarningDialogText-t TO "The sum of loans entered was «MainDialogSubTotal-n». However, the total amount of your loan was «LoanAmount-n». If this is correct please hit NEXT. If this is a mistake please select MISTAKE." ASK WarningDialog IF WarningDialogMistake-b ThisComputation // Substitute with the name of this computation END IF END IF
This is similar to Computation #0017: Message Box. Its purpose is to warn the user when one of their answers is problematic. The user is then given the option of going back and changing their answer, or keeping their answer and proceeding.
Requires:
Example. The example provided creates a warning for a repeated dialog. The dialog is used to gather loan amounts. When the user hits Finish, the warning dialog will appear if conditions are met to trigger a warning.
It is set up as follows:
Some of the variables are initially set to UNANSWERED so that everything is reset prior to the computation. It is especially important for MainDialogSubTotal-n to not have a value when the main dialog is asked. That is why the ASK command is before the "SET MainDialogSubTotal-n..." command. As a result, "SET MainDialogSubTotal-n..." uses the results from the "ASK..." command. Make sure that definitions like that are always after the ASK so that they are based on the previous results.
The ASK works well. A REPEAT isn't necessary, and might create havoc (I found it troublesome, in fact).
The "IF MainDialogSubTotal-n != PreviousNumberEntered-n" is the condition that determines whether or not the warning dialog should be triggered and sets it correctly.
If the user selects Mistake, the computation will call itself. This repeats the whole process.
If you would like to make the warning text more dynamic and complex, see Computation #0017: Message Box. This one uses only dynamic numbers.