Email score problem

More
1 month 3 days ago #160424 by marektondryk
marektondryk created the topic: Email score problem
Hi,
i have survey with equations assessment on email.
there are 7 questions gropus. For each questoin group i use assesment:

{(sum(qb1.value,qb2.value,qb3.value,qb4.value,qb5.value,qb6.value,qb7.value,qb8.value,qb9.value,qb10.value)/40)*100}%

qb1-qb10 are hidden equations questions. max score for each group is 40 (4points for each question).

Is it possible to put some text depends on score value? i.e if score is 0-20% in emal is displayed text "very poor score:, 21-40% "poorscore", 41-60% "avarage score", 61-80% "good score", 81-100% "very good score"

Please Log in to join the conversation.

More
1 month 2 days ago - 1 month 2 days ago #160459 by Joffm
Joffm replied the topic: Email score problem
Hi,
The Buzzword is "Tayloring".
https://manual.limesurvey.org/Expression_Manager#Tailoring_.2F_Piping

If you had provided a sample survey I could show more detailled.

But something like:

Your result is {if(sumQB<=20,"very poor",if(sumQB<=40,"poor",if(sumQB<=60,"average",if(sumQB<=80,"good","very good"))))}

Joffm
Last Edit: 1 month 2 days ago by Joffm.

Please Log in to join the conversation.

More
1 month 1 day ago #160505 by marektondryk
marektondryk replied the topic: Email score problem
Thank You Joffm!
There wasn't one coma, I changed to:

{if(sumqb<=20,"very poor",
if(sumqb<=40,"poor",
if(sumqb<=60,"average",
if(sumqb<=80,"good",
if(sumqb<=100,"very good")))))}

but it doesn't work... in email is displayed

"if(sumqb<=20,"very poor",
if(sumqb<=40,"poor",
if(sumqb<=60,"average",
if(sumqb<=80,"good",
if(sumqb<=100,"very good")))))"

without curly braces '{}'... :ohmy:

Please Log in to join the conversation.

More
4 weeks 1 day ago #160525 by marektondryk
marektondryk replied the topic: Email score problem
LimeSurvey
version 2.67.3+170728

curly braces doesn't work...

Please Log in to join the conversation.

More
4 weeks 1 day ago #160529 by Joffm
Joffm replied the topic: Email score problem
Hi,
please read about the if-function.

In your example the "false"-part is missing.

If(condition,true part,false part)

Joffm

Please Log in to join the conversation.

More
4 weeks 12 hours ago #160538 by marektondryk
marektondryk replied the topic: Email score problem
{if(sumqb<=20,"very poor",if(sumqb<=40,"poor",if(sumqb<=60,"average",if(sumqb<=80,"good",if(sumqb<=100,"very good")))))}

Underline isn't false part for 1st condition? Isn't it something like 'nested conditions'?

Please Log in to join the conversation.

More
4 weeks 11 hours ago - 4 weeks 11 hours ago #160540 by tpartner
tpartner replied the topic: Email score problem
I think Joffm's point is that every if() statment needs s true and false result and your last nested if() statement appears to be missing the false result.

{if(sumqb<=20,"very poor",
if(sumqb<=40,"poor",
if(sumqb<=60,"average",
if(sumqb<=80,"good",
if(sumqb<=100,"very good", "")))))}

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 4 weeks 11 hours ago by tpartner.

Please Log in to join the conversation.

More
4 weeks 11 hours ago #160542 by tpartner
tpartner replied the topic: Email score problem
...or, slightly simplified:

{if(sumqb<=20,"very poor",
if(sumqb<=40,"poor",
if(sumqb<=60,"average",
if(sumqb<=80,"good", "very good"))))}

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
4 weeks 10 hours ago #160546 by marektondryk
marektondryk replied the topic: Email score problem
Thank You tpartner!
"If statment" seems to be all right, but I still have problem with braces...
If I put code:
{if(sumqb<=20,"very poor",
if(sumqb<=40,"poor",
if(sumqb<=60,"average",
if(sumqb<=80,"good", "very good"))))}

braces "{,}" disappears and just text is displayed:

if(sumqb<=20,"very poor",
if(sumqb<=40,"poor",
if(sumqb<=60,"average",
if(sumqb<=80,"good", "very good"))))


and calculations doesn't work...

Another caluculations in the same email works perfect:
{(sum(qb1.value,qb2.value,qb3.value,qb4.value,qb5.value,qb6.value,qb7.value,qb8.value,qb9.value,qb10.value)/40)*100}%
I have no idea what is wrong....

Please Log in to join the conversation.

More
4 weeks 10 hours ago #160548 by Joffm
Joffm replied the topic: Email score problem
Hi,
did I understand correctly?

You have the calculation
{(sum(qb1.value,qb2.value,qb3.value,qb4.value,qb5.value,qb6.value,qb7.value,qb8.value,qb9.value,qb10.value)/40)*100}%

and

{if(sumqb<=20,"very poor",
if(sumqb<=40,"poor",
if(sumqb<=60,"average",
if(sumqb<=80,"good", "very good"))))}

in the email?

If you calculated "sumqb" before why calculate it again here?

Or didn't you? Then "sumqb" is undefined.

Just an idea.

Best you provide a sample.

Best regards
Joffm

Please Log in to join the conversation.

More
3 weeks 6 days ago #160576 by Joffm
Joffm replied the topic: Email score problem
Hi,
please, check your email template in source code modus.
Sometimes the editor changes "<=" to the HTML "&le;"
In that case you should use "le" instead of "<=".
https://manual.limesurvey.org/Expression_Manager#Operators

Or try to turn your statement.

{if(sumqb>80,"very good",if(sumqb>60,"good",if(sumqb>40,"average",if(sumqb>20,"poor","very poor"))))}


And the curly braces are never displayed if there is an error in the statement. You only see the incorrect statement itself.

Joffm

Please Log in to join the conversation.

More
3 weeks 6 days ago - 3 weeks 6 days ago #160588 by marektondryk
marektondryk replied the topic: Email score problem
Here is test survey (att). @ to admin - calculations
{if(sumqb>80,"very good",if(sumqb>60,"good",if(sumqb>40,"average",if(sumqb>20,"poor","very poor"))))}
doesn't work.
{(sum(qb1.value,qb2.value,qb3.value,qb4.value,qb5.value,qb6.value,qb7.value,qb8.value,qb9.value,qb10.value)/40)*100}%
works properly, default template
Attachments:
Last Edit: 3 weeks 6 days ago by marektondryk.

Please Log in to join the conversation.

More
3 weeks 6 days ago #160589 by tpartner
tpartner replied the topic: Email score problem
I don't see any equation question with code "sumqb".

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 weeks 6 days ago #160590 by marektondryk
marektondryk replied the topic: Email score problem
Hi Joffm,
when I put
{(sum(qb1.value,qb2.value,qb3.value,qb4.value,qb5.value,qb6.value,qb7.value,qb8.value,qb9.value,qb10.value)/40)*100}
in the place of 'sumqb' still doesn't work...

Please Log in to join the conversation.

More
3 weeks 6 days ago #160591 by marektondryk
marektondryk replied the topic: Email score problem
Hi tpartner,
should I make equation question with code "sumqb" with calculation (inside the question):

{(sum(qb1.value,qb2.value,qb3.value,qb4.value,qb5.value,qb6.value,qb7.value,qb8.value,qb9.value,qb10.value)/40)*100}

???

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!