Thomas Gibbons Consulting Qualtrics Wiki

Contact TomG on Qualtrics Community

User Tools

Site Tools


matrixhilo

matrixHiLo - Get highest and lowest selected recode values, statements, and scale points from a matrix

The matrixHiLo function sets embedded data fields for the highest and lowest selected recodes in a likert or bipolar matrix and the statements and scale points associated with those recodes. The embedded data fields can be used for piping or display logic in follow-up questions.

The matrixHiLo function gets added to the matrix itself, so no additional logic is needed and the fields are available for use on the next page.

The matrixHiLo function saves six fields for each question:

  • The highest selected recode value
  • The highest selected scale point
  • The highest selected statement or statements
  • The lowest selected recode value
  • The lowest selected scale point
  • The lowest selected statement or statements

Features:

  • Supports Likert (Allow one answer, Dropdown, or Drag and drop) or Bipolar matrix questions.
  • Statements and scale points can be saved as HTML, text only or variable names
  • Supports statements with entered text
  • Supports exclusion of 'Not applicable' scale points
  • Highest/lowest fields can be piped or used in display logic on the next page - no additional questions, blocks, or survey flow logic needed.
  • Flexible embedded data field naming

This function is available for a reasonable fee. Contact TomG on the Qualtrics Community to learn more.

Set-up Instructions

Survey Header

Add the matrixHiLo function to the survey header to make it available to any question in the survey. Go to Look & Feel → General → Header edit → and paste the provided matrixHiLo function JS:

<script>/*Paste matrixHiLo function JS here*/</script>

Alternatively, paste the matrixHiLo function JS into a question's JS outside the existing Qualtrics functions to make it available to questions on the page.

Question JavaScript

Add JS to call the matrixHiLo function to apply it to a ranking question as follows:

Qualtrics.SurveyEngine.addOnload(function() {
	matrixHiLo(this);
});

To override the default options, specify the desired options in the second function argument as an object. For example:

Qualtrics.SurveyEngine.addOnload(function() {
	matrixHiLo(this,{prefix:"Q1"});
});

Embedded Fields

The matrixHiLo function saves highest and lowest recode values and associated statements and scale point. Since multiple statements could have the same recode, statements are joined together (e.g., Statement 1, Statement 2, Statement 3).

Embedded Field Names

Recode Values

High: {prefix}{delim}{hiText}{delim}{recodeText} (e.g., Q1.hi.recode)
Low: {prefix}{delim}{loText}{delim}{recodeText} (e.g., Q1.lo.recode)

Statements

High: {prefix}{delim}{hiText}{delim}{stmtText} (e.g., Q1.hi.stmt)
Low: {prefix}{delim}{loText}{delim}{stmtText} (e.g., Q1.lo.stmt)

Scale Point

High: {prefix}{delim}{hiText}{delim}{scaleText} (e.g., Q1.hi.scale)
Low: {prefix}{delim}{loText}{delim}{scaleText} (e.g., Q1.lo.scale)

Saving Embedded Fields

For maxtrixHiLo embedded data fields to be saved to Qualtrics response data the names must be defined as embedded fields in the survey flow. The embedded data fields must be defined before they are set in the matrix question. Only the fields that need to be saved need to be defined in the survey flow. For example, if you are only interested in high values, only add those embedded data fields to the survey flow. It is not necessary to save fields in order to pipe them.

Options

bpDelim

bpDelim is a string delimiter that applies only to bipolar matrix questions. The specified string is used to separate the left and right statements.

Default: " / "

delim

delim is a string delimiter used to break the embedded data field names into sections. The delimiter is placed between each section.

Default: "."

enteredTextOnly

enteredTextOnly is a boolean that only applies to statements with “Allow text” turned on. When enteredTextOnly is true and the entered text field is not blank, only the entered text is included in the statement text (e.g., “this is the entered text”). When enteredTextOnly is false the entered text, if not blank, is added to the statement text (e.g., “Statement 1: this is the entered text”).

Default: false

hiText

hiText is a string used in embedded data field names of “high” recode value, statements, and scale point.

Default: "hi"

join

join is a string used to join multiple statements into a single string.

Default: ", "

loText

loText is a string used in embedded data field names of “low” recode value, statements, and scale point.

Default: "lo"

naRecode

naRecode is string that specifies the recode value of a “not applicable” scale point. A “not applicable” scale point is ignored for highest/lowest consideration. A blank value (“”) means there is no “not applicable” scale point.

Default: ""

prefix

prefix is a string used at the beginning of embedded data field names.

Default: questionId (e.g. QID1)

recodeText

recodeText is the text used at the end of embedded data field names that contain recode values.

Default: "recode"

scaleText

scaleText is the text used at the end of embedded data field names that contain scale points.

Default: "scale"

stmtText

stmtText is the text used at the end of embedded data field names that contain statements.

Default: "stmt"

textOnly

textOnly is a boolean used to remove HTML from statements and scale point labels when set to true.

Default: false

textVar

textVar is a boolean used to save statement and scale point variable names instead of display (HTML) or text values when textOnly AND textVar are true.

Default: false

Qualtrics Wiki

matrixhilo.txt · Last modified: 2023/06/21 09:50 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki