Assign Answer from Array to a Category

3 years 2 months ago #137183 by michaelji
Can I and, how can I assign an array answer to a category in order to tally the category?

The respondent chooses column 2 in the array for Option 1. I want to assign Category 3 with a value of 2.

Next question, similar, chooses column 5 for Option 3. This should be assigned Category 1with a value of 5.

The goal is to report to the admin that this respondent rates in Category 1, so far
And better yet, report to the admin the score of the four categories to the admin in the "Detailed admin notification"


tpartner wrote: I'm still not convinced this is the best design but you could do something like this:

<script type="text/javascript" charset="utf-8">	
		// Identify this question
		var thisQuestion = $('#question{QID}');
		// Assign column-specific classes
		$('table.subquestion-list tr', thisQuestion).each(function(i) {
			var scale = 1;
			$('> *:gt(0)', this).each(function(i){
				$(this).addClass('column-'+(i+1)+' scale-'+scale+'');
				$(this).attr('data-column', i+1);
				$(this).attr('data-scale', scale);
				if(i == 1) {
		// Listener on the radios
		$('', thisQuestion).on('click', function(e){
			$('', thisQuestion).prop('disabled', false);
			$('', thisQuestion).each(function(e) {
				var thisCell = $(this).closest('td.answer-item');
				var thisScale = $(thisCell).attr('data-scale');
				$('td[data-scale="'+thisScale+'"]', thisQuestion).not(thisCell).find('').prop('disabled', true);
		// Insert scale headers and separator
		$('colgroup', thisQuestion).remove();
		$('.scale-1.column-1', thisQuestion).before('<td class="inserted-scale-separator"></td>');
		$('.scale-1.column-2', thisQuestion).after('<td class="inserted-scale-separator"></td>');
		$('table.subquestion-list thead', thisQuestion).prepend('<tr class="scale-headers">\
																	<td class="inserted-scale-separator"></td>\
																	<th class="text-center scale-1" data-scale="1" colspan="2">Scale 1</th>\
																	<td class="inserted-scale-separator"></td>\
																	<th class="text-center scale-2" data-scale="2" colspan="2">Scale 2</th>\
		// Some styles (could be done in template.css)
		$('.inserted-scale-separator', thisQuestion).css({
			'width': '5px',
			'background-color': '#FFFFFF'
		$('thead .scale-1', thisQuestion).css({
			'background-color': '#8da6c1',
			'font-weight': 'bold'
		$('thead .scale-2', thisQuestion).css({
			'background-color': '#a7bacf',
			'font-weight': 'bold'
		$('tbody .scale-1', thisQuestion).css({
			'background-color': '#c0cedd',
			'font-weight': 'bold'
		$('tbody .scale-2', thisQuestion).css({
			'background-color': '#dae2eb',
			'font-weight': 'bold'
		// Insert a "Reset" button
		$('table.subquestion-list', thisQuestion).after('<input type="button" style="float:right;" value="Reset Question" class="resetQuestionButton" />');
		$('.resetQuestionButton', thisQuestion).click(function(e){
			$('', thisQuestion).prop('checked', false);
			$('', thisQuestion).prop('disabled', false);

Sample survey attached:

File Attachment:

File Name: limesurvey...9829.lss
File Size:18 KB

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
3 years 2 months ago #137202 by tpartner
Please do not ask the same question in multiple threads. If someone had an answer, they would have given it.

I suspect you can achieve what you want with equation type questions if you read the Expression Manager documentation.

Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner -

Please Log in or Create an account to join the conversation.

3 years 2 months ago #137228 by michaelji
Sorry for the cross post...I cannot edit the original and the typo error. I figured that people could not search on a misspelled topic heading.

I will check the suggestion you made and plow through the manual for my answer. I thought it would be an easy answer to and easy question. Limesurvey, since it is group effort is difficult at times to figure out. The manual references the older version and older interface, so I have to try and interpret what is being described in relation to the new menus and interface.

BTW, thanks for the answer/suggestion, rant aside...

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!