0 votes
in SoSci Survey (dt.) by s121453 (130 points)
reshown by s121453

Warnung: Die Funktion floatval() ist nicht zur Verwendung im Fragebogen freigegeben.
Warnung: PHP-Code auf Seite 2 enthält Funktionen oder PHP-Elemente, die nicht für die Verwendung im Fragebogen freigegeben wurden. Falls Sie der Meinung sind, dass die monierten Konstrukte ungefährlich sind, setzen Sie sich bitte mit dem Administrator in Kontakt!

I would need help with that for my conjoint analysis

1 Answer

0 votes
by SoSci Survey (305k points)

Instead of the function $a = floatval($b) please simply use the cast $a = (float)$b.

by s121453 (130 points)
edited by s121453
Thanks for your quick reply. I can't find the function in the code, but could be my fault. Is there the option that an Admin approves the floatval() function?
by SoSci Survey (305k points)
>  I can't find the function in the code

The floatval() is very likely there, on page 2, if the error message says it is.

> Is there the option that an Admin approves the floatval() function?

I do not really see the point, as this can easily be replaced?! But, well, it it makes life easier for people... done.
by s121453 (130 points)
Thanks for your answer!
Now another problem came up in the same code.
Unsupported operand types: string + int
in line 10: 010 $task = $task + 1;

How to proceed here?
by SoSci Survey (305k points)
It seems that $task is a string variable. Please place a

debug($task);

before that line to see more details. Also feel free to provide more of your code, so I get an idea about the context. The solution *may* be

$task = (float)$task + 1;
by s121453 (130 points)
///////////////////////////////////////////////////////
//$task = 3;

option('progress', 'yes');
$task = value('CJ01_02');
$task = (float)$task + 1;
put('CJ01_02', $task);

$total_attributes = 9;

$val = value('CJ01_01');

if ($val){

    $returnarray = json_decode($val);

    $table = '';
    $header = '<tr><th></th><th> Projekt E</th><th> Projekt F</th></tr>';
    for ($i=1; $i<=$total_attributes ; $i++){
        $table .= '<tr><th>'.
        $returnarray['F-'.$task.'-'. $i].
        '</th><td>'.
        $returnarray['F-'.$task.'-1-'. $i].
        '</td><td>'.
        $returnarray['F-'.$task.'-2-'. $i].
        '</td></tr>';
    }
    html('<table border="4" cellpadding="10" cellspacing="0" >'.$header. $table . '</table>');

} else {
        goToPage('fail');
}


html("</br>");

That's how the code looks like. I added your solution here already.
Also new error occurs:
Fehler im Fragebogen: Undefined array key "F-7-1"
Zeile: 25

PHP-Code

022     $header = '<tr><th></th><th> Projekt E</th><th> Projekt F</th></tr>';
023     for ($i=1; $i<=$total_attributes ; $i++){
024         $table .= '<tr><th>'.
025         $returnarray['F-'.$task.'-'. $i].
026         '</th><td>'.
027         $returnarray['F-'.$task.'-1-'. $i].
028         '</td><td>'.
by SoSci Survey (305k points)
> Undefined array key "F-7-1"

Well, it says that the variable $returnarray does not have an entry with the key "F-7-1". And it seems that your code requests that key in this line:

$returnarray['F-'.$task.'-'. $i].

You can take a look at the available keys, adding another debug()

$returnarray = json_decode($val);
debug($returnarray);

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

...