Welcome to the LimeSurvey Community Forum

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

Display previous entered formula correctly

  • mariaa
  • mariaa's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 3 weeks ago #182345 by mariaa
Hi all,

I´ve created a mathematical quiz. In the end each participant gets displayed a summary of his anwers so that he can check if they are correct.

In the quiz there is a an open question.

On the picture below, the correct answer is entered. You can see that there are already some symbols underlined.



In the end of the survey the answer is displayed with errors.




This is my syntax for the summary of this question:

You answered: {A2.shown}

Please check if you answered correctly.


There doesn´t seem to be any problem about the syntax. When I insert eg. "apple" as answer for question no. 2 the same text is displayed in the question summary. So this problem just occurs for formulae like {∅, {a}, {{b}}, {a, {b}}}.


Do you know if there is any way to display the formula correctly in the summary? Does my syntax needs to be extended?

Thanks a lot for your support since I don´t have any starting point to solve this problem.

Below, please find the lss

File Attachment:

File Name: limesurvey...5415.lss
File Size:44 KB



Kind regards

Maria
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 3 weeks ago #182354 by tpartner
Replied by tpartner on topic Display previous entered formula correctly
I don't see that equation anywhere in the attached survey.

If you want Expression Manager to ignore curly braces, insert a space after the opening brace and before the closing brace.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: mariaa
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 3 weeks ago - 5 years 3 weeks ago #182359 by Joffm
Replied by Joffm on topic Display previous entered formula correctly
Hello, Maria,

well it's quite obvious.
To display the answer you have to use curly brackets. But your answer itself contains the mathematical symbols "{" and "}" to indicate the set.

There is a way to display:
Have a space after the "{" and before the "}

Then you get (just an example):


So with some equations and string functions replace "{" by "{ " and "}" by " }"

Like this:
After A2 insert a question of type equation (hidden) and enter
{A2=str_replace('{','{ ',A2)}
{A2=str_replace('}',' }',A2)}

Viel Erfolg
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 3 weeks ago by Joffm.
The following user(s) said Thank You: DenisChenu, mariaa
The topic has been locked.
More
5 years 3 weeks ago #182362 by cdorin
Replied by cdorin on topic Display previous entered formula correctly
+1 to the responses from above.

If you don't add the space, LimeSurvey interprets what is inside curly brackets as an expression. That is why you also get the respective error message:

manual.limesurvey.org/Expression_Manager...elopers#How_EM_Works

Manual: manual.limesurvey.org/LimeSurvey_Manual
Bugs tracker: bugs.limesurvey.org/my_view_page.php
If you self-host and need help, contact one of our partners: limesurvey.com
Please do not contact me via PM - thank you.
The following user(s) said Thank You: mariaa
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 3 weeks ago #182364 by tpartner
Replied by tpartner on topic Display previous entered formula correctly
You should also be able to use { and } - brajeshwar.github.io/entities/

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: mariaa
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 3 weeks ago - 5 years 3 weeks ago #182369 by DenisChenu
Replied by DenisChenu on topic Display previous entered formula correctly
I really think it's an issue … Expression Manager must not replace value from user entered variable …
But must test if able to allow it in equation at the same time.

Edit : reported and assigned : bugs.limesurvey.org/view.php?id=14698

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.
Last edit: 5 years 3 weeks ago by DenisChenu. Reason: Edit : reported and assigned
The following user(s) said Thank You: tpartner, mariaa
The topic has been locked.
  • mariaa
  • mariaa's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 3 weeks ago #182385 by mariaa
Replied by mariaa on topic Display previous entered formula correctly
Thanks a lot tpartner, I didn´t know this tip (inserting a space) before.
The topic has been locked.
  • mariaa
  • mariaa's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 3 weeks ago #182386 by mariaa
Replied by mariaa on topic Display previous entered formula correctly
Hi Joffm,

thanks a lot for your helpful tip. I inserted two equations like proposed and now it´s working. The replace function might be very helpul for future surveys =)

Beste Grüße und einen schönen Abend

Maria
The following user(s) said Thank You: DenisChenu, cdorin
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose