2 Replies Latest reply on Oct 10, 2017 9:42 AM by sbt RSS
    michaelfr Creator



    I am trying to use a validator widget in my mashup. I have the following code but it doesn't seem to work. Not sure how to write the expression in the validator. I have a parameter input to the widget called Expanded.

    if Expanded = False then Output = True else if Expanded = True then Output = False

    Thank you,


      • Validator
        adam Creator

        Hi Mike,


        The Expression widget expects JavaScript just as our


        do. You have a couple of options when writing this particular expression – given the small size of the Expression text box, I recommend using the most concise and least error-prone expression possible. Keep in mind, '=' is the assignment operator and '==' is a relational operator which tests for equality. Furthermore, the boolean keywords 'true' and 'false' should be lowercased and there is no 'then' keyword in JavaScript.

        Since Expanded is a boolean value a simple if-else will suffice. You can take advantage of the logical negation operator along with the conditional operator (?) to get a nice short expression:

        !Expanded ? true : false;

        or, if you prefer something closer to what you had:

        if (Expanded == false) { result = true; } else { result = false; }



          • Re: Validator
            sbt Explorer

            Hello Adam,

            Just saw this post and was curious to ask weather i can validate the expression below using Validator widget.


            IF(1000 100;10;20)


            1. mA1 and mA2 are replaced with the values later.

            2. And also i have used if condition between the expression.

            If i cannot achieve the same using validator widget, what is the best possible solution to my problem.