Developer Documentation Library > Interview templates > UXUI built-in templates > CategorySum template
 
CategorySum template
Use the CategorySum template to get a running total for a categorical question. Set the uxui_category_value for each category to specify the value for the sum.
If the total label and prefix symbol need to be translated into other languages, use totalLabelId instead of the totalLabel and prefixSymbol.
Associated uxui_template_props
initialValue
Specify the initial value for the total. This value is added to the contents of the cells as they are entered.
The default value is 0.
totalLabel
Specify the label to be displayed to the left of the total. To remove the label, specify an empty string.
The default value is "TOTAL:".
totalLabelId
Use totalLabelId when the sum needs to be embedded in the label string. In this case, the string for the total is extracted from a metadata resource instead of a custom property, so this method can also be used if translated labels are required for the total. For more information, see Translating text in the UXUI custom properties.
When using the totalLabelID, include %{SUM} in the label to indicate where to put the running total.
For example:
CatSum3_TotalLabel "Total is $%{SUM} for all versions chosen"
info;
CatSum3 "Which versions would you purchase? (totalLabelId, set showCategoryValue and showBorder to false)?<span class='uxui-resource'><span id='catsum3_total'>{#CatSum3_TotalLabel.Label}</span></span>"
[
uxui_template_name = "CategorySum",
uxui_template_props = "{ totalLabelId: 'catsum3_total', showCategoryValue: false, showBorder: false }"
]
prefixSymbol
Set a prefix for the total. For example, to show a currency symbol in front of the total, you might set prefixSymbol to $.
The default value is blank.
showCategoryValue
Specify whether you want to display the numeric values defined for the category (true or false).
The default value is true.
showBorder
Specify whether you want to display borders around the categories (true or false).
The default value is true.
precision
Specify the precision used to display the total; that is, the number of digits after the decimal point. The default value is 0.
Applies to
Categorical questions
Example
CatSum2 "Which would you add to your cart? (set initalValue, totalLabel, prefixSymbol, precision)"
[
uxui_template_name = "CategorySum",
uxui_template_props = "{ initialValue: 50, totalLabel: 'Total cart:', prefixSymbol: '$', precision: 2 }"

]
categorical [1..]
{
Product1 "Product 1"
[
uxui_category_value = "20.50"
],
Product2 "Product 2"
[
uxui_category_value = "15.80"
],
Product3 "Product 3"
[
uxui_category_value = "9.99"
],
None "None of these" fix exclusive
};
See
Interview templates