View Issue Details

This bug affects 1 person(s).
 14
IDProjectCategoryView StatusLast Update
17477Bug reportsExpression Managerpublic2021-11-24 16:37
Reportertammo Assigned Togalads  
PrioritylowSeverityfeature 
Status testingResolutionopen 
Product Version3.25.19 
Target Version5.0.0dev 
Summary17477: Make it possible to use answer option text in expression script.
DescriptionSomehow this feature request was deleted, so I enter it again.

Use case: setting up a quiz.
Using Radio lists only.
All questions are coded A1, A2, A3 and A4 as answer options, where we replace the answer code of the correct option with a C.
Example (question code is q01):
q01 Which answer is correct?
   A1 Wrong Answer 1
   C Correct answer
   A3 Wrong answer 2
   A4 Wrong answer 3

In an evaluation afterwards I would like to show:

    the question {q01.question}
    the given answer {q01.shown}
    and an evaluation {if(q01=="C", "Correct answer", "Wrong answer")}

And when the answer given by the user was wrong I want to show what the correct answer was.

Something like: {if(q01!="C", "The correct answer is" q01_C.text, "")}

But currently there is no way to get the text of an answer option (or subquestion) using expression script.
TagsNo tags attached.
Bug heat14
Complete LimeSurvey version number (& build)Version 3.27.7+210713
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySQL
Server OS (if known)
Webserver software & version (if known)
PHP Version7.3

Users monitoring this issue

User List DenisChenu

Activities

ritapas

ritapas

2021-07-26 16:26

reporter   ~65637

upvote
tpartner

tpartner

2021-07-26 16:28

developer   ~65638

Last edited: 2021-11-24 16:37

+1
DenisChenu

DenisChenu

2021-07-26 16:57

developer   ~65639

Last edited: 2021-11-24 16:37

subquestion text => .question

MULTI_SQ01.question show the text of SQ01
tammo

tammo

2021-07-26 17:54

developer   ~65640

Last edited: 2021-11-24 16:37

OK, only answer option then?
DenisChenu

DenisChenu

2021-07-26 18:11

developer   ~65641

Last edited: 2021-11-24 16:37

Question_Subquestion.question are already in 3.X. Unsure what happen for array/text and array/number

I think i already another feature request for 5.X

Question text of "Multiple choice question" : https://github.com/LimeSurvey/LimeSurvey/tree/master/application/core/plugins/expressionQuestionForAll
Question help : https://github.com/LimeSurvey/LimeSurvey/tree/master/application/core/plugins/expressionQuestionHelp

Here : can be lcearly done with plugin but unsure on the code …
DenisChenu

DenisChenu

2021-07-27 11:51

developer   ~65644

Last edited: 2021-11-24 16:37

> I think i already another feature request for 5.X

OK, got it !
https://forums.limesurvey.org/forum/can-i-do-this-with-limesurvey/124986-show-the-text-of-a-specific-answer-option-with-expression-script#218509
tammo

tammo

2021-11-14 12:06

developer   ~67284

Last edited: 2021-11-24 16:37

@denis how much time would it cost you to program this?
DenisChenu

DenisChenu

2021-11-14 12:16

developer   ~67285

Last edited: 2021-11-24 16:37

@tammo : unsure : i need a good way to have the current aswer …

QCode.answers_C1shown : give the answer text of Qcode with C1 code ? Not the best maybe …
DenisChenu

DenisChenu

2021-11-14 12:17

developer   ~67286

Last edited: 2021-11-24 16:37

View 2 revisions

@tammo : why not use a fuinction answerTextByCode(QCODE,"C1") ? or answerTextByCode(QCODE_SQCODE,"C1")
tammo

tammo

2021-11-14 12:39

developer   ~67288

Last edited: 2021-11-24 16:37

Why not use... Because I have never heard of this code.

Can I use this in Expression code?
tammo

tammo

2021-11-14 12:40

developer   ~67289

Last edited: 2021-11-24 16:37

By the way: I am not looking for the chosen answer, but for the answer that has code "C" (for correct answer)
DenisChenu

DenisChenu

2021-11-15 08:10

developer   ~67292

Last edited: 2021-11-24 16:37

> Why not use... Because I have never heard of this code.

No : i mean why not create a expression manager function :)

 > By the way: I am not looking for the chosen answer, but for the answer that has code "C" (for correct answer)

yes : answerTextByCode(QCODE,"C") or answerTextByCode(QCODE_SQCODE,"C") (for array question type)
tammo

tammo

2021-11-15 09:38

developer   ~67322

Last edited: 2021-11-24 16:37

I do not know how to create Expression Script code. I asked if you could help me on that. How much time would it cost you to program this?
DenisChenu

DenisChenu

2021-11-15 11:31

developer   ~67324

Last edited: 2021-11-24 16:37

My question : are you OK with such a solution : answerTextByCode(QCODE,"C") ?

Create a new function in a core plugin + a test : 1 day work.
tammo

tammo

2021-11-15 11:46

developer   ~67326

Last edited: 2021-11-24 16:37

I would like you to develop this, yes, please send me a quote for how much money this would cost me.

Condition: answerTextByCode(QCODE,"C") must be usable as Expression Script.
Mazi

Mazi

2021-11-17 09:58

partner   ~67385

Last edited: 2021-11-24 16:37

@tammo, this can be really useful for creating more generic quizzes. Are you planning to provide this plugin to the community?

We are currently working on a different approach for a "Limesurvey quiz generator":
At a very simple interface you can define a welcome and end text and question items of type multi choice. These include:
1. Question text
2. Answers (sub-questions)
3. An array indicating which are the correct answers (e.g.: "SQ001, SQ003, SQ007)
4. Maybe also a help text at which we can later include additional text feedback.

Additional question items can be added by clicking [+]. Once all question details are defined, the plugin will generate the related Limesurvey survey automatically.

The user can take the survey and at the end will be presented an overview with all questions. At that overview his/her questions will be marked as well as the correct answers. We will also calculate a score like the percentage of correct answers.
Theoretically, we can also add more benchmark items like comparing the user's total score with the overall total score of all participants or showing the percentages of correct answers per question.
tammo

tammo

2021-11-17 10:07

developer   ~67388

Last edited: 2021-11-24 16:37

I only want to develop this (or have this developed by a good coder) for open source.

This what I developed based on current software. The feature I asked here is very much wanted.

https://research.respondage.com/index.php/365639?newtest=Y&lang=nl-informal

Denis made an offer. I would be glad to share the costs.
Mazi

Mazi

2021-11-17 10:12

partner   ~67389

Last edited: 2021-11-24 16:37

Well, currently we do not need the feature you outlined for any projects. What Limesurvey version are you developing this for? Will it support 3.x and 5.x?

The tool I described is not coded yet. We are currently looking for other customers with a similar demand.
DenisChenu

DenisChenu

2021-11-17 10:19

developer   ~67391

Last edited: 2021-11-24 16:37

5.X only.
No way to update ExpressionManager before 4.X
DenisChenu

DenisChenu

2021-11-17 10:21

developer   ~67392

Last edited: 2021-11-24 16:37

NOT RELATED :

> https://research.respondage.com/index.php/365639?newtest=Y&lang=nl-informal


Warning with autoclic : i start,
1. Clic on Radio (JS click on Next)
2. Move my mouse to Next button and Click
3. I don't answer to page 2.
tammo

tammo

2021-11-17 10:24

developer   ~67393

Last edited: 2021-11-24 16:37

NOT RELATED :
Thanks Denis, I will look into that.
DenisChenu

DenisChenu

2021-11-17 10:42

developer   ~67394

Last edited: 2021-11-24 16:37

Maybe show button without JS only ?
tammo

tammo

2021-11-17 10:53

developer   ~67395

Last edited: 2021-11-24 16:37

You mean, that when JS autoclick is activated, it also hides the next button?
DenisChenu

DenisChenu

2021-11-17 11:29

developer   ~67396

Last edited: 2021-11-24 16:37

No : i mean IF auto click work : seem better to hide Next button (except if you allow no answer ?)
Or show it after a timing ?
See screencast
Here : i force, but 1st time i really do it without see …
Peek 17-11-2021 11-28.gif (156,614 bytes)
DenisChenu

DenisChenu

2021-11-18 15:45

developer   ~67433

Last edited: 2021-11-24 16:37

@galads : i create a function in a plugin (Thanks to https://www.respondage.nl/ for sponsoring).

After : we can add it on core plugin : start by scale_id == 0 and with answers in DB.

By qid or question code
galads

galads

2021-11-18 15:53

administrator   ~67434

Last edited: 2021-11-24 16:37

Thanks, @DenisChenu and https://www.respondage.nl/ , we can add it to the develop branch?
DenisChenu

DenisChenu

2021-11-18 16:00

developer   ~67436

Last edited: 2021-11-24 16:37

It's the option
1. Plugin for master (with a specific name)
2. Core plugin, same function name but different plugin name (then my plugin can disable itself if core plugin is activated … :/)
DenisChenu

DenisChenu

2021-11-23 14:36

developer   ~67509

Last edited: 2021-11-24 16:37

5.X plugin https://gitlab.com/SondagesPro/ExpressionManager/ExpressionAnswerOptionsExt
DenisChenu

DenisChenu

2021-11-24 16:36

developer   ~67540

Last edited: 2021-11-24 16:37

Pull request for develop version.
DenisChenu

DenisChenu

2021-11-24 16:37

developer   ~67541

Last edited: 2021-11-24 16:37

https://github.com/LimeSurvey/LimeSurvey/pull/2155

@galads : can you set it at "To be tested" in zoho please ?

Issue History

Date Modified Username Field Change
2021-07-26 16:25 tammo New Issue
2021-07-26 16:26 ritapas Note Added: 65637
2021-07-26 16:28 tpartner Note Added: 65638
2021-07-26 16:57 DenisChenu Note Added: 65639
2021-07-26 17:54 tammo Note Added: 65640
2021-07-26 18:11 DenisChenu Note Added: 65641
2021-07-27 11:51 DenisChenu Note Added: 65644
2021-07-29 08:38 galads Assigned To => galads
2021-07-29 08:38 galads Status new => acknowledged
2021-07-29 10:07 galads Priority none => low
2021-07-29 10:07 galads Severity minor => feature
2021-07-29 10:07 galads Sync to Zoho Project => |Yes|
2021-08-13 15:10 galads Status acknowledged => confirmed
2021-11-14 12:06 tammo Note Added: 67284
2021-11-14 12:16 DenisChenu Note Added: 67285
2021-11-14 12:17 DenisChenu Note Added: 67286
2021-11-14 12:17 DenisChenu Note Edited: 67286 View Revisions
2021-11-14 12:39 tammo Note Added: 67288
2021-11-14 12:40 tammo Note Added: 67289
2021-11-15 08:10 DenisChenu Note Added: 67292
2021-11-15 08:34 DenisChenu Summary Make it possible to use answer option text and subquestion text in expression script. => Make it possible to use answer option text in expression script.
2021-11-15 09:38 tammo Note Added: 67322
2021-11-15 11:31 DenisChenu Note Added: 67324
2021-11-15 11:46 tammo Note Added: 67326
2021-11-16 14:14 DenisChenu Issue Monitored: DenisChenu
2021-11-16 14:14 DenisChenu Bug heat 8 => 10
2021-11-17 09:58 Mazi Note Added: 67385
2021-11-17 09:58 Mazi Bug heat 10 => 12
2021-11-17 10:07 tammo Note Added: 67388
2021-11-17 10:12 Mazi Note Added: 67389
2021-11-17 10:19 DenisChenu Note Added: 67391
2021-11-17 10:21 DenisChenu Note Added: 67392
2021-11-17 10:24 tammo Note Added: 67393
2021-11-17 10:42 DenisChenu Note Added: 67394
2021-11-17 10:53 tammo Note Added: 67395
2021-11-17 11:29 DenisChenu Note Added: 67396
2021-11-17 11:29 DenisChenu File Added: Peek 17-11-2021 11-28.gif
2021-11-18 15:41 DenisChenu Assigned To galads => DenisChenu
2021-11-18 15:45 DenisChenu Note Added: 67433
2021-11-18 15:45 DenisChenu Status confirmed => assigned
2021-11-18 15:45 DenisChenu Target Version 3.x => 5.0.0dev
2021-11-18 15:53 galads Note Added: 67434
2021-11-18 15:53 galads Bug heat 12 => 14
2021-11-18 16:00 DenisChenu Note Added: 67436
2021-11-18 16:02 galads Status assigned => new
2021-11-18 16:02 galads Assigned To DenisChenu => galads
2021-11-18 16:02 galads Status new => confirmed
2021-11-18 16:02 galads Status confirmed => assigned
2021-11-23 14:25 DenisChenu Assigned To galads => DenisChenu
2021-11-23 14:36 DenisChenu Note Added: 67509
2021-11-24 16:36 DenisChenu Note Added: 67540
2021-11-24 16:37 DenisChenu Note Added: 67541
2021-11-24 16:37 DenisChenu Assigned To DenisChenu => galads
2021-11-24 16:37 DenisChenu Status assigned => testing