These operators compare answer values to other answer values or to values that you enter. You can compare numeric, date and time values, as well as text values.


The comparison operators always follow an ifq; for example:

ifq(10) // if the answer to question 10
.greaterThan(Q (20)) // is greater than the answer to question 20


ifq(10) // if the answer to question 10
.greaterThan(100) // is greater than 100


Please note you will want to start your rules with the .answered() rule to ensure that the comparison only takes place until the relevant questions are answered!


For instance:

ifQ(31)
.answered()
.andQ(41)
.answered()
.andifQ(31)
.greaterThan(Q(41))
.setError("In time is later than out time!");



.equalTo

ifQ(41)
.equalTo(Q(51))
.setError("41 & 51 are equal");

// .. can also be used

// equalTo(777)  // literal number


.notEqualTo

ifQ(41)
.notEqualTo(Q(51))
.setError("41 & 51 are not equal");

// .. can also be used

// notEqualTo(777)  // literal number


.greaterThan

ifQ(31)
.greaterThan(Q(41))
.setError("In time is later than out time!");

// can also use literal numbers

// .greaterThan(777)


.greaterThanOrEqual

ifQ(31)
.greaterThanOrEqual(Q(41))
.setError("31 is expected to be less!"); 

// can also use literal numbers
// .greaterThanOrEqual( 777 )


.lessThan

ifQ(61)
.lessThan(21)
.setError("Age must be 21 to perform a compliance shop");

// can also use Questions

// .lessThan(Q(21))


.lessThanOrEqual

ifQ(61)
.lessThanOrEqual(400)
.appear( QRange(101,201));

// can also use Questions

// .lessThanOrEqual(Q(21))