Survey [[question variable]] now returns the shown answer text for multiple choice questions, and the recorded value for non-multiple choice questions.

This commit is contained in:
Kaleb Murphy 2009-04-10 17:46:17 +00:00
parent 2b2e876b6d
commit 8cd5588f10
3 changed files with 10 additions and 5 deletions

View file

@ -738,12 +738,18 @@ sub responseValuesByVariableName {
# Grab the corresponding question
my $question = $self->survey->question([@address]);
# Filter out questions without defined variable names
next if !$question || !defined $question->{variable};
#Test if question is a multiple choice type so we can use the answer text instead
my $answerText;
if($self->survey->getMultiChoiceBundle($question->{questionType})){
$answerText = $self->survey->answer([@address])->{text};
}
# Add variable => value to our hash
$lookup{$question->{variable}} = $response->{value};
$lookup{$question->{variable}} = $answerText ? $answerText : $response->{value};
}
return \%lookup;
}