Actions

Question type - Equation/zh-cn: Difference between revisions

From LimeSurvey Manual

(Created page with "{{QS:必答}}")
(Created page with "=显示=")
Line 66: Line 66:
{{QS:relevance}}
{{QS:relevance}}


=Display=
=显示=


{{QS:Hidden}}
{{QS:Hidden}}

Revision as of 05:59, 10 September 2020

简述

Template:提示

Template:提示

  出于安全考虑,任何 HTML 标签不能存入数据库。


本问题类型用来创建一个可以保存在数据库变量中的方程式 (例如计算器或是定制报告) 。方程式问题使用可以 表达式脚本里支持的任何语法。请确保你使用了下面提到的高级问题设置仅数字在你处理数值的时候。

你可以通过下面的示例了解如何使用这个问题类型:




示例: Limesurvey_survey_BMIsample.lss.zip.

编辑方程式问题

使用专用设置

编辑方程式的最佳方法是使用专用设置:可以为不同的语言使用相同的方程式,还有确保方程式里没有整合HTML语句。可以保证完整显示说明语句的同时,只在数据库中保存必要的数值:比如把 {weightkg/tall} 放进公式然后显示 “Your BMI is {self.NAOK}”.

如果你要内置表达式:你就必须要使用花括号。

使用问题文本

你可以通过 HTML/WYSIWYG 编辑器或是 HTML source源码来编辑:

  • 使用所见即所得编辑器:



  • 从HTML 源代码:



当你需要一份纯文字或纯数字的反馈记录的时候,建议在源码中编辑。修改源码的时候,你可以删除任何可能影响存储过程的 HTML 代码。



提示: 要了解其他 HTML 编辑器,请查看 百科中的 HTML 编辑器模式部分.

常规选项

QS:必答


Condition (previously "Relevance equation")

Description

If the result value of the condition is "1" or "true", the question is "relevant" in the survey context, i.e. it is shown to the survey participant. If not, the question is hidden. Any survey question allows you to specify a relevance equation. This function is the successor of conditions and supports much more complex conditional logic.

Syntax Highlighting

Whenever you save the condition, it is evaluated and syntax-highlighted. Any errors will be color coded so that you can quickly detect and fix them.

 Hint: To check if all conditions are used correctly within your survey, read about our show logic file feature.


Valid values

  • Any condition that makes use of the ExpressionScript syntax, without surrounding curly braces.

Examples

Here are good examples of syntax highlighting.


显示

Always hide this question (hidden)

Description

If enabled, the question will always be hidden - it will not be displayed to the survey participants. This function can be used in the following scenarios:

  • If you wish to prefill a question with a URL and you want not to have it displayed on the screen. This overrides any conditions used within the survey because the respective question will not even be embedded on the page.
  • If you wish to store or calculate a value on the fly via the ExpressionScript - Presentation.
Note: A common question type that is used with this function is the Equation one.

Available options

  • On
  • Off (default)


CSS class (css_class)

Description

If you want to add special CSS classes to certain questions, you can enter the CSS class name(s) in this box. Make sure you leave an empty space between different class names.

Valid values

  • Any text string with a space between different CSS class names.
 Hint: You can also insert an expression in this box (New in 3.0.0 ). Remember that the output of the expression will not be updated dynamically.


  According to the W3C, CSS class names can contain only the characters [a-zA-Z, and 0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_). They cannot start with a digit, or a hyphen followed by a digit. LimeSurvey encodes CSS classes, but it does not fix it totally.



Relevance help for printable survey (printable_survey_relevance_help)

Description

If you wish to print a survey, you can also print the relevance equations for each question. But, if you wish to offer instead an explanation rather than the expression on the printed form, fill in this box with the text explanation for the relevance equation.

Valid values

  • Any text and/or numbers you wish to be displayed on the printable form.


Logic

Equation (equation)

Description

The result of the expression you type here will be stored in the response table and NOT the result(s) of the expressions typed in the question textbox. For example, you may want to display several expressions in the question textbox to display the respondents some statistics about herself. However, if you wish to store something different at the same time, then type the desired expression in this field.

This equation is used for all language.

Valid values


Other

Insert page break in printable view (page_break)

Description

This attribute is only active when you actually print a survey from the Printable View. It forces a page break before the question.

Available options

  • On
  • Off (default)



SPSS export scale type (scale_export)

Description

This is used for SPSS export only. This attribute overrides the default scale guessed by SPSS. To learn what the different measurement scales do, please read the related SPSS documentation.

Available options

  • Default (default)
  • Nominal
  • Ordinal
  • Scale


Numbers only (numbers_only)

Description

If you enable this option, the participant can only enter numbers in the text box(es).

For the equation question types, this setting indicates that the result could only be a number, not a string. This will guarantee proper calculations/conversions in follow-up equations regarding the decimal mark.

Behavior by question type

  1. Default: If the subject enters a value that is not a number, that value is immediately cleared from the text box so that the subject can enter an appropriate value.
  2. Array (Texts): If the numbers only option is disabled, the "Show totals for" and "Show grand total" options will be overruled, while the total text boxes will not be displayed.
  3. Equation: Enabling this option will force the equation results to be converted to a numeric value. If the equation result is not a number (and not blank), the equation will return NaN, being saved as an empty string in the response table.

Available options

  • On
  • Off (default)


Statistics

Show in public statistics (public_statistics)

Description

This attribute allows the survey administrator to chose if a particular question results should be displayed to the survey participants after they submitted the survey.

Note: To have the statistics displayed on the last page, do not forget to enable this functionality from the presentation & navigation settings. Otherwise, no statistics link will be displayed at the end of your survey.

The default setting for each question is 'Off' (=Do not show the question statistics to the respondents). You have to enable this for every single question if you want to show the survey statistics of that (those) particular question(s) to the survey participants after the survey submission.

Available options

  • On
  • Off (default)



Display chart (display_chart)

Description

This attribute allows the survey administrator to choose if a chart that contains the question results should be displayed to the survey participants after they filled out the survey.

Note: To have the chart displayed on the last page, you have to enable the following options:


Available options

  • On
  • Off (default)



Chart type (chart_type)

Description

This attribute allows the survey administrator to choose which type of chart will be displayed to the respondent once he/she finished filling out the survey.

Note: Do not forget to change the question and survey settings in order to have the charts displayed at the end on the survey. For more details, check the wiki section on the display chart question attribute.

Available options

  • Bar chart
  • Pie chart
  • Radar
  • Line
  • PolarArea
  • Doughnut