此图像显示了一种审查调查的相关性逻辑的方法。它计算体重指数(BMI)。关联方程式在变量名称后面的方括号中显示(以绿色显示)。因此,weight,weight_units,height和height_units的相关性都是1,这意味着总是会问这些问题。然而,BMI的相关性是{!is_empty(height) and !is_empty(weight)},这意味着只有当受试者输入身高和体重的值时才会计算BMI(从而避免除以零出错的风险)。此外,仅当主题回答所有四个主要问题(身高,身高,体重,体重,体重_单位)时,才会显示报告问题。
Warning with mismatch between number and string and alphabetic comparison
When you want to compare value with relative or equality comparisons, pay attention to type mismatch. Value entered by user or answer code selected can be used as number if it's clearly a number.
If you surround one of the values with "it will force the comparison as text (alphabetic compare). If you want to compare numerically, never surround the number with quotation marks, ".
For example Q0.NAOK > "50" is true if Q0.NAOK is a numeric question with 9 as value. This is because the operator > will assume it's alphabetical compare and not numerical.
To be sure to compare integer value, you can use intval(Q0.NAOK) > 50, just remember if Q0.NAOK is not a number (empty or a string), then intval(Q0.NAOK) == 0. To compare string value ("A" < "B") use strcmp directly : strcmp(Q0.NAOK,"B") or strcmp(Q0.NAOK,"A5").
Assignment is done only in PHP. This doesn't update any values on the same page, but only when the user navigates with next, previous, save ….
If you don't use an equation question type for this purpose: the assignment is done only after the logic of the current page is done. The recommended method is to always use an equation question.
{if( 1 ,"<strong>","")}information{if( 1 ,"</strong>","")} is broken with XSS security, here you can use {if(1,"<strong>information</strong>","information")}
<a href="/script.php?value={if(QCODE == "Y","yes","no")}">next</a>, here you can use an equation question because using a complete question code is OK : <a href="/script.php?value={EQUATION.NAOK}">next</a>
目前提供以下函数:
number abs(number)
number acos(number)
addslashes
Quote string with slashes
string addslashes(string)
number asin(number)
number atan(number)
atan2
Arc tangent of two variables
number atan2(number, number)
Round fractions up
number ceil(number)
checkdate
Returns true(1) if it is a valid date in gregorian calendar
bool checkdate(month,day,year)
convert_value
Convert a numerical value using a inputTable and outputTable of numerical values
number convert_value(fValue, iStrict, sTranslateFromList, sTranslateToList)
number cos(number)
count
count the number of answered (non-blank)questions in the list
number count(arg1, arg12, ..., argN)
countif
Count the number of answered questions in the list equal the first argument
number countif(matches, arg1, arg2, ... argN)
countifop
Count the number of answered questions in the list which pass the criteria (arg op value)
number countifop(op, value, arg1, arg2, ... argN)
格式化本地日期/时间
string date(format [, timestamp=time()])
Calculates the exponent of e
number exp(number)
fixnum
Display numbers with comma as radix separator, if needed
string fixnum(number)
floor
Round fractions down
number floor(number)
gmdate
格式化GMT日期/时间
string gmdate(format [, timestamp=time()])
html_entity_decode
Convert all HTML entities to their applicable characters (always uses ENT_QUOTES and UTF-8)
string html_entity_decode(string)
htmlentities
Convert all applicable characters to HTML entities (always uses ENT_QUOTES and UTF-8)
string htmlentities(string)
expr_mgr_htmlspecialchars
Convert special characters to HTML entities (always uses ENT_QUOTES and UTF-8)
string htmlspecialchars(string)
expr_mgr_htmlspecialchars_decode
Convert special HTML entities back to characters (always uses ENT_QUOTES and UTF-8)
string htmlspecialchars_decode(string)
idate
Format a local time/date as integer
string idate(string [, timestamp=time()])
Excel-style if(test,result_if_true,result_if_false)
if(test,result_if_true,result_if_false)
implode
Join array elements with a string
string implode(glue,arg1,arg2,...,argN)
intval
Get the integer value of a variable
int intval(number [, base=10])
is_empty
Determine whether a variable is considered to be empty
bool is_empty(var)
is_float
Finds whether the type of a variable is float
bool is_float(var)
is_int
Find whether the type of a variable is integer
bool is_int(var)
is_nan
Finds whether a value is not a number
bool is_nan(var)
is_null
Finds whether a variable is NULL
bool is_null(var)
is_numeric
Finds whether a variable is a number or a numeric string
bool is_numeric(var)
is_string
Find whether the type of a variable is string
bool is_string(var)
join
(New in 2.0 build 130129)
Join elements as a new string
join(arg1, arg2, ... argN)
Return comma-separated list of non-blank values
string list(arg1, arg2, ... argN)
The logarithm of number to base, if given, or the natural logarithm.
number log(number,base=e)
ltrim
Strip whitespace (or other characters) from the beginning of a string
string ltrim(string [, charlist])
寻找最大值
number max(arg1, arg2, ... argN)
寻找最小值
number min(arg1, arg2, ... argN)
mktime
Get UNIX timestamp for a date (each of the 6 arguments are optional)
number mktime([hour [, minute [, second [, month [, day [, year ]]]]]])
modulo-function
The modulo function is
not supported
yet. You can use the floor() function instead
floor(x/y)==(x/y)
nl2br
Inserts HTML line breaks before all newlines in a string
string nl2br(string)
number_format
Format a number with grouped thousands
string number_format(number)
获取pi的值
number pi()
Exponential expression
number pow(base, exp)
quoted_printable_decode
Convert a quoted-printable string to an 8 bit string
string quoted_printable_decode(string)
quoted_printable_encode
Convert a 8 bit string to a quoted-printable string
string quoted_printable_encode(string)
quotemeta
Quote meta characters
string quotemeta(string)
Generate a random integer, see
this example
int rand() OR int rand(min, max)
regexMatch
compare a string to a
regular expression
bool regexMatch(pattern,input)
round
Rounds a number to an optional precision
number round(val [, precision])
rtrim
Strip whitespace (or other characters) from the end of a string
string rtrim(string [, charlist])
number sin(arg)
sprintf
Return a formatted string
string sprintf(format, arg1, arg2, ... argN)
Square root
number sqrt(arg)
stddev
Calculate the Sample Standard Deviation for the list of numbers
number stddev(arg1, arg2, ... argN)
str_pad
Pad a string to a certain length with another string
string str_pad(input, pad_length [, pad_string])
str_repeat
重复字符串
string str_repeat(input, multiplier)
str_replace
Replace all occurrences of the search string with the replacement string
string str_replace(search, replace, subject)
strcasecmp
Binary safe case-insensitive string comparison
int strcasecmp(str1, str2)
strcmp
Binary safe string comparison
int strcmp(str1, str2)
strip_tags
Strip HTML and PHP tags from a string
string strip_tags(str, allowable_tags)
stripos
Find position of first occurrence of a case-insensitive unicode string (starting by 0, return false if not found)
int stripos(haystack, needle [, offset=0])
stripslashes
Un-quotes a quoted string
string stripslashes(string)
stristr
Case-insensitive strstr
string stristr(haystack, needle [, before_needle=false])
strlen
Get string length
int strlen(string)
strpos
Find position of first occurrence of an unicode string (starting by 0, return false if not found)
int strpos(haystack, needle [ offset=0])
strrev
Reverse a string
string strrev(string)
strstr
Find first occurrence of a string
string strstr(haystack, needle[, before_needle=false])
strtolower
Make a string lowercase
string strtolower(string)
strtotime
Parse about any English textual datetime description into a Unix timestamp
int strtotime(string)
strtoupper
Make a string uppercase
string strtoupper(string)
substr
Return part of an unicode string
string substr(string, start [, length])
Calculate the sum of values in an array
number sum(arg1, arg2, ... argN)
sumifop
Sum the values of answered questions in the list which pass the criteria (arg op value)
number sumifop(op, value, arg1, arg2, ... argN)
number tan(arg)
Return current UNIX timestamp
number time()
Strip whitespace (or other characters) from the beginning and end of a string
string trim(string [, charlist])
ucwords
Uppercase the first character of each word in a string
string ucwords(string)
unique
Returns true if all non-empty responses are unique
boolean unique(arg1, ..., argN)
Old Feature
New Feature
Comments
你可以使用非常复杂的条件方程式,并访问更广泛的变量
任何评估分数都可以重新组织成方程式。这既可以确保将分数写入数据库,也可以让你看到当前页面上分数值的动态变化
表达式管理器
核心引擎获取输入字符串并将花括号中的所有内容视为表达式 - 因此它处理所有历史替换类型。为了避免搞乱嵌入式JavaScript,表达式管理器只处理花括号之间的内容,只要(a)花括号内没有前导空格或尾随空格 - 例如{expr}是表达式,但{expr},{expr},和{expr}不是表达式。此外,Expression Manager不会在其自己的字符串中处理内容(例如{list('hi','there {braces}')}生成“hi there {braces}”)。它也忽略了转义的花括号(例如\ {这不是表达式\})
表达式管理器
计划是采用当前的最小/最大问题属性并拥有表达式管理器处理它们。这样,最小/最大值可以是表达式本身
语法突出显示
为了帮助输入和验证表达式,EM提供了语法突出显示功能,具有以下功能:
语法突出显示的类型和含义
棕褐色背景
Sample
整个方程式
花括号中被识别为方程式的任何东西(例如,没有前导或尾随空白)将用棕褐色背景进行颜色编码,以帮助将其与周围文本区分开来
粗体红色文本
Sample
关于错误的一些解释
可以是一个未知变量或函数中的错误,……调查可以被完全破坏,所以不要向公众用户展示。
Sample
含义和允许语法
函数名称,或者应该是函数的东西,因为它们后跟一个左括号,以粗体蓝色文本显示。工具提示显示函数的含义和允许的语法。
Sample
单引号和双引号字符串以灰色文本显示
Sample
variable set on the same page,
[name or SGQA code]: question; value; answerList showing codes for each value
Any variable that is set on the same page to the current question is shown in cyan text, showning it can be updated in javascript. The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set). If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.
green text
Sample
variable set on a prior page
[name or SGQA code]: question; value; answerList showing codes for each value
Any variable that is set on a prior page is shown in bold green text. The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set). If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.
bold pink text
Sample
variable set on a later page
in general : empty at survey start, but can be filled with index or move previous
[name or SGQA code]: question; value; answerList showing codes for each value
Any variable that is set on a prior page is shown in bold pink text. The tooltip shows its name (if you used INSERTANS:xxx) or SGQA code (if you used the new naming system), the actual question, and its current value (or blank if not set). If the question type expects responses from an enumerated value set, the mapping of the codes to display values is show.
bold tan text
Sample
a lime replacement value
the value
Lime Replacement Strings (like {TOKEN:xxx}, {PRIVACY_MESSAGE}) are shown in bold tan text.
red text
Sample
assignment operator (=)
warning message
If you use one of the assignment operator (=) that operator will be displayed in red text. This is meant to help prevent accidental re-assignment of values when you really meant to check whether a == b instead of setting the value of a = b.
normal black text
Sample
punctuation
All other punctuation within the expression is shown as normal black text.
red-boxed text
a bold red line surrounds the error
syntax error
description of the error
Any detected syntax errors are shown by surrounding the error with a red box. The tooltip shows the error. Examples include unmatched parentheses, use of undefined functions, passing the wrong number of arguments to functions, poorly structured expressions (e.g. missing operators between variables), trying to assign a new value to a read-only variable, trying to assign values to non-variables, or using unsupported syntax. Note that the syntax error dectection system may only report one error in an expression even if there are multiple errors; however, if any errors are detected, at least one error will be shown.