Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Validation code for a variable less than another variable

I want an error message if a number is entered in Q10 that is larger than Q9

I have used the below code however I get error if any number is entered in Q10 unless it is 0.

        if (SSI_GetValue("Q9") < SSI_GetValue("Q10"))
        {
        strErrorMessage = 'Error message here.';
       
    }

How should I be writing the code?
asked Aug 19 by Ineke

1 Answer

0 votes
 
Best answer
Assuming this is in the footer of Q10 and that Q9 is on a previous page you want to use Sawtooth Script [%%] to call a previous answer.

 if ([%Q9%] < SSI_GetValue("Q10"))
        {
        strErrorMessage = 'Error message here.';
       
    }
answered Aug 19 by Jay Rutherford Gold (38,005 points)
...