Thomas Gibbons Consulting Qualtrics Wiki

Contact TomG on Qualtrics Community

User Tools

Site Tools


csmaddtotals

csmAddTotals - Constant sum matrix with row and column totals

The csmAddTotals function adds row or column totals to a constant sum matrix. If the question is configured to show row totals, csmAddTotals automatically adds column totals. If the question is configured to show column totals, csmAddTotals automatically adds row totals.

Functionality includes:

  • Optionally display grand total
  • Optionally require a specific grand total
  • Supports back button
  • Automatically supports before and after symbols
  • Automatically supports translations

Here is an example that adds row totals:

Here is an example that adds column totals with grand total turned off:

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

Set-up Instructions

Add Function To Survey

Add the csmAddTotals 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 csmAddTotals function JS:

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

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

JavaScript Function Call

Add JS to call the csmAddTotals function to apply it to the matrix question as follows:

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

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

Qualtrics.SurveyEngine.addOnload(function() {
	csmAddTotals(this,{grandTotal:false});
});

Question Settings

  • Matrix
  • Matrix Type: Constant Sum
  • Add Total Box: On

Options

grandTotal

grandTotal is a boolean that specifies if a grand total should be displayed.

Default: true

grandMustTotal

grandMustTotal is a number greater than 0 (zero) that the grand total must add to when grandTotal is true. When the grand total is not equal to grandMustTotal the next button is disabled and the grand total is displayed in red. When the grand total is equal to grandMustTotal the next button is enabled and the grand total is displayed in green.

Default: 0

Qualtrics Wiki

csmaddtotals.txt · Last modified: 2023/10/28 15:42 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki