Identify Profile from 4 quiz scores

0

Hi,

I’m building a personality quiz, and I need to identify the profile based on the maximum score among 4 quiz scores.

The script below correctly retrieves the maximum score, but the part (IF statements) to display the related profile is not working effectively.

I would be very grateful if someone can please help me?

Many thanks,

Gilles

 

%%Profileone = sgapiGetValue(1);

%%Profiletwo=sgapiGetValue(2);

%%Profilethree=sgapiGetValue(3);

%%Profilefour=sgapiGetValue(4);

 

%%totalvalues=array(sgapiGetValue(1),sgapiGetValue(2),sgapiGetValue(3),sgapiGetValue(4));

 

%%maximumvalue=sgapiPrint_R(sgapiMax(%%totalvalues));

 

if (%%Profileone = %%maximumvalue)

{  %%output = “Profileone”; }

 

if (%%Profiletwo = %%maximumvalue)

{  %%output = “Profiletwo”; }

 

if (%%Profilethree = %%maximumvalue)

{  %%output = “Profilethree”; }

 

if (%%Profilefour = %%maximumvalue)

{  %%output = “Profilefour”; }

 

sgapiSetValue(5,%%output);

Gilles Renaud answered
    0

    Thank you Jim.

    Quiz is now working fine !!!

    Cheers,

    Gilles

    Gilles Renaud answered
      0

      I’m sorry that I don’t have time to go over this in detail, but I will take a swag at it.  Try replacing the ‘=’ in your IF statement with”==”. A single equal sign in PHP is used in calculations or to declare a variable; a double equal sign is used to compare two values to see if they are equal.

      Jim Wetherill edited answer
        ×

        Login

        Question stats

        • Active
        • Views2451 times
        • Answers2 answers
        • Followers2 followers