Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Problems in creating assessments using Expression Manager

  • mstolk
  • mstolk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #120944 by mstolk
Hi there,


I could really use your help in creating assessments using Expression Manager.
I am using Limesurvey Version 2.05+ Build 150520.

Using an example I found in the manual, I created a personality test and used the expression "if" to define which scores should result in wich texts:

"{if(ScoreExtraversion < 16,'text low extraversion',if(ScoreExtraversion < 29,'text medium extraversion', etc.."

But I found out I cannot format the text in quotes (add pictures and white lines), while I would like to make a fancy overview for the participants.

So my solution to this problem was putting the texts into new hidden questions:
1. text_low_extraversion: A fancy text with picture
2. text_medium_extraversion: A different fancy text with picture
3. etc.

and refer to this texts in my 'if'-expression:
"{if(ScoreExtraversion < 16,'{text_low_extraversion.question}',if(ScoreExtraversion < 29,'{text_medium_extraversion.question}', etc..

And although this works (yes!), besides the corresponding fancy text with picture, also the questioncode is visible, for example:

"Extraversion 20%
{text_low_extraversion.question}

-scale picture-

On the scale of introvert - extrovert you score low .
It means you tend to be more focused on internal thoughts, feelings and moods rather than seeking out external stimulation."


I really hope there is a way to get rid of this code.



Another problem I am having is that some assessments do not work (text does not show), though the rules seem to be exactly the same as the rules I made for other (working) assessments.


Because my test contains a lot of questions (120) and a lot of assessments (20), it is really difficult to find out what the reason is they don't work.
If I test only the questiongroup for this assessment, it does work. When I look at the QA, there are no faults. I also checked the text was not hidden.

Does anyone have tips and tricks for me to find out why they don't work?
Maybe because they had similar problems?
Maybe because there is a limit in the number of expressions or something?

It's difficult to explain, I hope my story is clear.


Thanks in advance!

Best regards,

Marlou Stolk
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago #120947 by DenisChenu
Hi,

You can use HTML inside quote BUT : use different quote + Do not use line feed.

For exemple:
Code:
{if(1=1,"<img src='image.url' /><strong>OK</strong>","")}
But it can be very complicated with a lot of solution ...

The your solution seems good except one point : don't add again '{ and }'
Code:
{if(ScoreExtraversion < 16,text_low_extraversion.question,
   if(ScoreExtraversion < 29,text_medium_extraversion.question,
      ''
   )
)}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: mstolk
The topic has been locked.
  • mstolk
  • mstolk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #121057 by mstolk
Hi,

And again thank you for your fast reaction.
I tried your suggestions, but I'm still having some problems.

When I don't add the '{ and }' like you said, the text is not showing at all when I test it.
I can only see it for a milisecond (laptop is kinda slow), and then it dissappears.

Do you know what could be the problem there?


And because you said I can use HTML inside the quote, I also tried to put the texts in the expression.
But I really want some white lines, something to make the text more readable, so I tried <br>, </br> and <p>.
So I tried the following:

{if(1=1, '<p>line of text</p><br><p><img src="image.url" /></p><br><p>alinea of text</p><br><p>Alinea of text</p>','')}

It worked in QA.
But when I was making the test, the text at the end was not:
Line of text

A picture

Alinea of text

Alinea of text


But it looked like:
Line of textAlinea of textAlinea of text

Without a picture or linebreaks!

Maybe I am using wrong codes, I'm new in this, but I really hope you can help me!

Thank you in advance.
The topic has been locked.
  • mstolk
  • mstolk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 9 months ago #121058 by mstolk
Oké, little adjustment: because maybe the <p>text</p><br><p>text</p> is strange, the break is between alinea's, but that's not the only thing I tried.
I tried <p> en </p> for the alinea's.
I tried <br><br> and also <br></br> to make a blank line.

It just doesn't work when I test it. Even the image is gone
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 9 months ago #121086 by tpartner
I find it easiest to place the HTML in separate equation type questions and then reference them in your expression..

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose