WinCross Executive Help

Logic

Logic contains the variable name(s), operator, value and optional connector.

 

Logic Operators:

Case sensitive:

=  equal to, in its entirety

<  less than

>  greater than

<>  not equal to

>=  greater than or equal to

<=  less than or equal to

{= starts with the given value

}= ends with the given value

~=  contains the given value

 

Case insensitive:

Use the % to indicate that an Operator should ignore case. For example, %=,%<>, %{=, %}= and %~=.

 

Associated Operators in logic:

( )   parentheses are used to control the order of evaluation

" "  double quotes are used for string values or formatted values for non-string variables (formatted values can be different from raw data values and take into consideration how the variable is formatted)

"" double quotes with no space between them are used to find a missing value

[ ]   brackets are used for code value labels

 

Connectors in logic:

AND (must be preceded and followed by a space)

OR   (must be preceded and followed by a space)

 

Use the NOT keyword to reverse the sense of the term that follows.

 

Example 1 - Logic without using a connector:

Syntax: Variable Operator Value

 

Q8 = 3

 

represents 'variable Q8 equal to the value 3'

 

Example 2 - Logic using a connector:

Syntax: Variable Operator Value Connector Variable Operator Value

 

Q8 = 3 AND Q9 = 5

 

represents 'variable Q8 equal to the value 3 and variable Q9 equal to the value 5'

 

SUB logic in Component Logic:

The first number indicates the loop count and the second number indicates the step count. If the second number is not present, then the step count is assumed to be 1. A positive or negative value for loop count indicates the direction.

Example1: 2 (means to subtotal the next 2 rows/columns)

Example 2: -2 (means to subtotal the previous 2 rows/columns)

Example 3: 3 STEP 2 (means for a loop count of 3, step forward 2 rows/columns and then subtotal)

Example 4: -3 STEP 2 (means for a loop count of 3, step back 2 rows/columns and then subtotal)

 

NPS logic in Component Logic:

There are two types of Net Promoter Score logic statements: Default and Custom. Default uses the standard 0-10 scale (9,10 for promoters, 7,8 for passives/neutral, 0-6 for detractors). Custom uses explicit values for use with alternative scales. Both types support complex logic when connected with an AND, and cannot be negated with NOT.

 

Syntax: $NPS=Variable optionally followed immediately by all three explicit parameters (see below).

Explicit parameter keywords:  $P (promoters), $D (detractors), $N (passives/neutral)

Parameter syntax: AND Keyword = Value(s) AND Keyword = Value(s) AND Keyword = Value(s)

 

Examples (simple logic):

$NPS=Q1

$NPS=Q1 AND $D=1,2 AND $N=3 AND $P=4-5

 

Examples (complex logic):

$NPS=Q1 AND (Income=1-2 OR Income > 5)

Gender=2 AND $NPS=Q1 AND NOT Income=2

Income > 5 AND $NPS=Q1 AND $P=4,5 AND $D=1,2 AND $N=3 AND Gender=2

 

 

Other examples:

Logic

Meaning

Q1 = 4

True when the value of Q1 is 4.

Q8 <> 3

True when the value of Q8 is not 3.

Q2 < 5

True when the value of Q2 is less than 5.

Q2 > 6 AND Q3 >= 2

True when the value of Q2 is greater than 6 and the value of Q3 is greater than or equal to 2.

Q5 = 1,3,5,7

True when the value of Q5 is 1, 3, 5 or 7.

Q3 = 1-4

True when the value of Q3 is 1, 2, 3 or 4.

Q1 = 1-3,5-9

True when the value of Q3 is in the range of 1 to 3 inclusive or 5-9 inclusive.

QT1_BRANCH = 0-99,

True when the value of QT1_BRANCH is in the range of 0 to 99 inclusive or is a missing value.

QT1_BRANCH = 0-10,,90-100

True when the value of QT1_BRANCH is in the range of 0 to 10 inclusive or is a missing value or is in the range of 90 to 100 inclusive.

QT1_BRANCH = ,0-99

True when the value of QT1_BRANCH is a missing value or is in the range of 0 to 99 inclusive.

GENDER = 1,M,Male

True when the value of the variable GENDER is 1, M or Male.

GENDER %= 1,M,Male

True when the value of the variable GENDER is equal to 1, M or m, Male or MALE, etc. Case is ignored when a % precedes an operator.

(Q2=4 OR Q3=4) AND (Q4=3 OR Q5=3) AND NOT (Q1>=2 AND Q2<7)

Parentheses are used to control the order of evaluation. The NOT keyword reverses the sense of the term that follows.

Q12 %="Happy"

True when the value of string variable Q12 is equal to "happy" or "HAPPY", etc. Case is ignored when a % precedes an operator.

Q6 <> "tasty"

True when the value of string variable Q6 does not equal "tasty". Use %<> to ignore case.

Q5 ~= "excited"

True when the value of string variable Q5 contains "excited" anywhere within the value. Use %~= to ignore case.

Q10 = ""

True when the value of variable Q10 is a missing value.

ZIPCODE {= 852

True when the value of numeric variable ZIPCODE starts with 852.

PARTNUM }= "J-52"

True when the string variable PARTNUM ends with "J-52". Use %}= to ignore case.

  OPTION>"B"

True when the value of string variable OPTION is greater than "B". For example, the strings "C", "Dog" and "Zebra" are all greater than "B".

DATE1="5-13-2016"

True when the value of DATE1 is equal to "5-13-2016".

GENDER = [Male]

True when GENDER has a value whose value label exactly matches "Male". If "Male" is the value label for code 1, this logic statement is equivalent to GENDER=1. Use %= to ignore case.

MOOD ~= [Disagree]

True when MOOD has a value whose value label contains "Disagree". Use %~= to ignore case.

#Total or #TotalAnswer or #TotalNoAnswer

Causes a user-defined total row, total answering row or no answer row to be inserted.

Related topics:

Logic set

Create Components from Variables