0 votes
in SoSci Survey (English) by s213018 (110 points)

So I made this definition that is supposed to grab the ranking of pictures and then add the picture according to the their rank and the value given in the table. (The code is below). I am having a problem starting from $texto. It is not grabbing the information and when I go to the debug method, it just appears as a string and a weird error appears. I will attach the picture below

code:
function get_heart($value, $ranking) {
debug($value);
debug($ranking);
$index = array_search($value, array_values($ranking));
debug($index);
$keys = array_keys($ranking);
debug($keys);
$a = $keys[$index];
debug($a);
$texto = getItemtext($a);
debug($texto);
$imageTitle = substr($texto, 10, -26);
debug($imageTitle);
$imageSource = 'image';
debug($imageSource);
return $imageSource ;

1 Answer

0 votes
by SoSci Survey (304k points)

The function getItemtext() expectes either a (full) item ID, such as AB01_01 or a question ID and item number, e.g.: getItemtext('AB01', 1)

L5 is no such ID that would identify an item, so it cannot resolve an item text.

As I do not know where the parameters for get_heart() are from, it's hard for me to give any useful hints what to change. If you ko´now the question ID, and $index identifies the item, this one might work:

getItemtext($questionID, $index + 1)

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...