View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 14817 | Bug reports | Expression Manager | public | 2019-04-25 19:26 | 2026-10-23 21:17 |
| Reporter | DenisChenu | Assigned To | c_schmitz | ||
| Priority | none | Severity | minor | ||
| Status | confirmed | Resolution | open | ||
| Product Version | 3.17.x | ||||
| Summary | 14817: count and comparaison broken with .question in JS | ||||
| Description | Using f(count(self.NAOK) == count(self.question) ,"OK","") in expression is broken … | ||||
| Steps To Reproduce | Import included survey, check the equation , test | ||||
| Additional Information | Isseu with .question in JS : seems LEManyNA('483539X527X7030SQ01.question', '483539X527X7030SQ02.question') send false or something like that ? | ||||
| Tags | No tags attached. | ||||
| Attached Files | |||||
| Bug heat | 6 | ||||
| Complete LimeSurvey version number (& build) | 3.17.2 github | ||||
| I will donate to the project if issue is resolved | No | ||||
| Browser | ff | ||||
| Database type & version | not relevant | ||||
| Server OS (if known) | not relevant | ||||
| Webserver software & version (if known) | not relevant | ||||
| PHP Version | not relevant | ||||
| Git branch / Pull Request URL | |||||
|
Updated : usage of .question seems the issue |
|
|
I am sorry but can you please explain what the error is? |
|
|
See the screenshot : |
|
|
I doubt that count(code.question) is a valid expression - and unless the question text is completely empty it should always return 1. Anyway in the case of that.Q00.question I would expect it to return the question text of the main question. But in this case it returns the question text of the last subquestion. |
|
|
No, because i use self : see https://manual.limesurvey.org/Expression_Manager#The_reserved_.27this.27.2C_.27self.27.2C_and_.27that.27_variables It work without issue when use it in PHP, but not comparing, where seems to use JS. See related forum post : https://www.limesurvey.org/community/forums/development/118215-detect-if-question-is-answered?start=15 |
|
|
In fact : the issue is really this : count(self.question) is OK via static variable, but not via dynamic variables. I have the same issue for https://github.com/LimeSurvey/LimeSurvey/pull/1256 and QCODE.help (or idea of function without JS equivalent : getStatOfQuestion ). |
|
|
In your example file (v2) you were not using self. You were using that.Q00.question |
|
|
Maybe you should start over with a more simple example file. |
|
|
code. question always gives back the question text. |
|
|
self and that.Q00 is same inside Q00 question See lss : OK in next page, broken in same page. |
|
|
Fixed lss : have error before, but same issue |
|
Number of question … there are difference in PHP and in JS : then there are issue … |
|
|
If the value of count(code.question) is undetermined because the expression is invalid in itself then it may well be different in JS and PHP. |
|
|
No need documentation : (if Question code are valid) The issue is Maybe EM need a «this is a fixed var, don't take it from javascript» |
|
|
Okay, I can agree on that one. So please close this one and reopen a new issue with "'qcode.question' and subqestioncode.question text not valid / set wrong on in-page EM expressions" Thank you! |
|
|
The strange issue is : count(QCODE.question) is OK but not when comparing or make evaluation with value in page.
It's the reason of the exact title … |
|
|
If you look at the content of qcode.question then you will see that it is not okay. |
|
|
Looking at HTML : It's a minor issue, but still an issue :). And this make big change on EM javascript (allow to have «fixed var», not updated by JS). |
|
I don't understand ? |
|
|
Why would you do count() on QCODE.question? It's a text field, no? Not an array. |
|
|
See https://bugs.limesurvey.org/view.php?id=14817#c51773 count(QCODE.question) must return 1, always. See https://bugs.limesurvey.org/view.php?id=14817#c51782 too |
|
Or invalidate the expression: "count() requires an array, found string" |
|
|
With {if(count(self.NAOK) == count(self.question) ,"OK","")} : the attended behaviour are if all answer are filled : get OK, else get "". |
|
|
But that's the same as count(self.NAOK) == 1? |
|
Not the case today, and clearly : User wait 1 … Like {count(QCODE.NAOK)} return 0 o 1. Manual :
|
|
No : count(self.NAOK) return 0 if answer is empty … It' in the lss and in the screenshot … https://bugs.limesurvey.org/file_download.php?file_id=11562&type=bug |
|
Yes, BUT ; with count(self.NAOK) == count(self.question) : you can use it in all quetsoion. Just copy/paster don't care of number of answers. |
|
|
So QCODE.question is an array IF there are subquestions?? |
|
|
No : that.QCODE.question QCODE.question didn't exist if it's an array (except with the plugin). |
|
|
Checked on current master with limesurvey_survey_countQuestionBrokenJS.lss:
The cause is not the subtraction itself but its position in the text. When the JavaScript for an expression that uses a fixed attribute (.question, .qid, .sgqa, ...) is built, the current group/question position of Expression Manager gets reset. Every expression after it in the same text is then treated as static and is not updated anymore. If the line before it is removed, the subtraction updates correctly. This only happens in group-by-group and question-by-question surveys. |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2019-04-25 19:26 | DenisChenu | New Issue | |
| 2019-04-25 19:26 | DenisChenu | File Added: limesurvey_survey_countCompare.lss | |
| 2019-04-25 19:26 | DenisChenu | File Added: Capture d’écran du 2019-04-25 19-25-53.png | |
| 2019-04-25 19:26 | DenisChenu | File Added: Capture d’écran du 2019-04-25 19-26-06.png | |
| 2019-04-25 19:26 | DenisChenu | File Added: Capture d’écran du 2019-04-25 19-26-24.png | |
| 2019-04-25 19:26 | DenisChenu | Relationship added | related to 14198 |
| 2019-04-25 19:27 | DenisChenu | Relationship added | related to 14337 |
| 2019-04-26 09:07 | DenisChenu | Summary | count and comparaison broken => count and comparaison broken with .question in JS |
| 2019-04-26 09:07 | DenisChenu | Description Updated | |
| 2019-04-26 09:07 | DenisChenu | Additional Information Updated | |
| 2019-04-26 09:07 | DenisChenu | Severity | partial_block => minor |
| 2019-04-26 09:07 | DenisChenu | Relationship deleted | related to 14198 |
| 2019-04-26 09:07 | DenisChenu | Relationship deleted | related to 14337 |
| 2019-04-26 09:09 | DenisChenu | File Added: limesurvey_survey_countCompare2.lss | |
| 2019-04-26 09:09 | DenisChenu | Note Added: 51582 | |
| 2019-05-03 16:33 | c_schmitz | Note Added: 51762 | |
| 2019-05-03 16:37 | DenisChenu | Note Added: 51763 | |
| 2019-05-03 17:10 | c_schmitz | Note Added: 51766 | |
| 2019-05-03 17:18 | DenisChenu | File Added: Capture d’écran du 2019-05-03 17-16-21.png | |
| 2019-05-03 17:18 | DenisChenu | Note Added: 51767 | |
| 2019-05-03 17:28 | DenisChenu | Note Added: 51768 | |
| 2019-05-03 17:30 | c_schmitz | Note Added: 51769 | |
| 2019-05-03 17:30 | c_schmitz | Note Added: 51770 | |
| 2019-05-03 18:00 | c_schmitz | Note Added: 51771 | |
| 2019-05-03 18:13 | DenisChenu | File Added: limesurvey_survey_countQuestionBrokenJS.lss | |
| 2019-05-03 18:13 | DenisChenu | File Added: Capture d’écran du 2019-05-03 18-11-53.png | |
| 2019-05-03 18:13 | DenisChenu | Note Added: 51773 | |
| 2019-05-03 18:15 | DenisChenu | File Deleted: limesurvey_survey_countQuestionBrokenJS.lss | |
| 2019-05-03 18:16 | DenisChenu | File Added: limesurvey_survey_countQuestionBrokenJS.lss | |
| 2019-05-03 18:16 | DenisChenu | Note Added: 51774 | |
| 2019-05-03 18:17 | DenisChenu | Note Added: 51775 | |
| 2019-05-03 18:34 | c_schmitz | Note Added: 51776 | |
| 2019-05-03 18:56 | DenisChenu | Note Added: 51777 | |
| 2019-05-03 18:57 | DenisChenu | Note Edited: 51777 | |
| 2019-05-03 18:57 | DenisChenu | Note Edited: 51777 | |
| 2019-05-03 19:01 | c_schmitz | Note Added: 51778 | |
| 2019-05-03 19:08 | DenisChenu | Note Added: 51779 | |
| 2019-05-03 19:08 | DenisChenu | Note Edited: 51779 | |
| 2019-05-03 21:26 | c_schmitz | Note Added: 51780 | |
| 2019-05-06 09:47 | DenisChenu | Note Added: 51781 | |
| 2019-05-06 09:50 | DenisChenu | File Added: Capture d’écran du 2019-05-06 09-49-20.png | |
| 2019-05-06 09:50 | DenisChenu | Note Added: 51782 | |
| 2021-05-12 15:48 | ollehar | Note Added: 64383 | |
| 2021-05-12 15:52 | DenisChenu | Note Added: 64387 | |
| 2021-05-12 15:52 | ollehar | Note Edited: 64383 | |
| 2021-05-12 15:53 | ollehar | Note Added: 64388 | |
| 2021-05-12 15:53 | DenisChenu | Note Added: 64389 | |
| 2021-05-12 15:55 | ollehar | Note Added: 64390 | |
| 2021-05-12 15:55 | DenisChenu | Note Added: 64391 | |
| 2021-05-12 15:57 | DenisChenu | Note Added: 64392 | |
| 2021-05-12 15:58 | DenisChenu | Note Added: 64393 | |
| 2021-05-12 15:59 | ollehar | Note Added: 64394 | |
| 2021-05-12 16:03 | DenisChenu | Note Added: 64395 | |
| 2021-05-12 16:04 | DenisChenu | Note Added: 64396 | |
| 2026-10-23 21:16 | c_schmitz | Note Added: 86741 | |
| 2026-10-23 21:17 | c_schmitz | Assigned To | => c_schmitz |
| 2026-10-23 21:17 | c_schmitz | Status | new => confirmed |