====== 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:\\
{{ ::csmaddtotals-addcol.mp4?800 |csmAddTotals - Row Totals}}
Here is an example that adds column totals with grand total turned off:\\
{{ ::csmaddtotals-addrow.mp4?800 |csmAddTotals - Column Totals}}
This function is available for a reasonable fee. Contact **[[https://community.qualtrics.com/inbox/conversation?with=373|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 -> {{::icon_source.jpg?20|}} and paste the provided csmAddTotals function JS:
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 **[[csmaddtotals#Options|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 **[[csmaddtotals#grandTotal|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 ======
[[start|Qualtrics Wiki]]