View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
06768Bug reports[All Projects] Expression Managerpublic2012-10-24 17:252012-11-06 14:41
Assigned Toc_schmitz 
Product Version2.00+ 
Target VersionFixed in Version2.00+ 
Summary06768: Relevance equation works at question level but not at the group level
DescriptionNot sure that this is actually a bug... could be just a enhancement request.

There is an expectation that the one could skip an entire group by using a relevance equation. I attached the sample survey that I am working with.
Steps To ReproduceFor the attached survey, the following logic developed for the first question of group 2 (G-1) works at the question level.

sum(766173X18X201SQ001.valueNAOK,766173X18X202SQ001.valueNAOK) >= 3

Moving this to the group level relevance equation fails.
I will donate to the project if issue is resolvedNo
LimeSurvey build number OR git commit ID121024
Database & DB-VersionMSSQL
Operating System (Server)Windows7
Webserver software & versionApache 2.4
PHP Version5.4.7
Attached Files? file icon limesurvey_survey_766173.lss [^] (20,484 bytes) 2012-10-24 17:25
? file icon limesurvey_survey_945857.lss [^] (27,476 bytes) 2012-10-25 13:50
? file icon limesurvey_survey_152167.lss [^] (282,132 bytes) 2012-10-31 02:57
? file icon survey_archive_383498.lsa [^] (5,767 bytes) 2012-10-31 12:23

- Relationships
related to 06808closedc_schmitz Inconsistent access to information from the token table 
child of 06744closedDenisChenu Expressionmanager show false error if admin lang are not in survey lang 

-  Notes
User avatar (21633)
DenisChenu (developer)
2012-10-24 21:30


2 things : can you put a lss files with functionnal condition : use condition editor for example, or a good expression manager.

In LS you make a sum(SGQA.valueNAOK ) but SHQA.valueNAOK are string here, not number.

Because : Relevance equation work at group level.
User avatar (21640)
TMSWhite (reporter)
2012-10-25 06:16

It works fine. You had a typo in your group-level relevance equation. It should have been:

sum(PHQ01_SQ001.valueNAOK, PHQ02_SQ001.valueNAOK) >= 3
User avatar (21649)
helper (reporter)
2012-10-25 13:47

I do not understand the note from Shnoulle.

TMSWhite: Sorry - this does not work fine. I took your suggestion and pasted directly into the group relevance equation AND removed the relevance equation from the question. No matter what I answer in the first two questions I get the group that I want to hide. Checked both of my installations (Windows7/MySQL and Windows2008r2/SQL Server) -- Same failure.
User avatar (21650)
helper (reporter)
2012-10-25 13:47

Rechecked this morning - see note.
User avatar (21651)
helper (reporter)
2012-10-25 13:50

Uploaded latest lss.
User avatar (21686)
TMSWhite (reporter)
2012-10-25 17:08

It works in all in one mode but not on group by group mode.
User avatar (21693)
TMSWhite (reporter)
2012-10-26 06:24

This works fine in all modes (question-by-question, group-by-group, and all-in-one) in version 1.92. It also used to work in 2.0, so it appears that a fix in the last few months broke that feature

I don't have time to address this issue, so I'm freeing it up for another developer.
User avatar (21696)
mdekker (developer)
2012-10-26 10:57

just tested the example survey: ls2_group_relevance and swithed to group-by-group mode and it worked just fine... so it is not just group mode but probably something more specific to this equation. (btw tested in preview mode)
User avatar (21697)
DenisChenu (developer)
2012-10-26 11:09

Thanks Menno ,

For preview mode : is survey preview, not Group preview ?

User avatar (21698)
mdekker (developer)
2012-10-26 11:13

complete survey, also attached survey here seems to work
User avatar (21699)
mdekker (developer)
2012-10-26 11:15

in runtime i get an error on the attached 945857
User avatar (21700)
mdekker (developer)
2012-10-26 11:27

Funny thing... when you put a reference like {sum(that.PHQ01.valueNAOK)} in second question, it seems to work. When you remove, it still works. Then logout, login... not working... must be some kind of caching issue.
User avatar (21701)
DenisChenu (developer)
2012-10-26 11:38

Argllll .... an EM cache issue ;)
User avatar (21702)
DenisChenu (developer)
2012-10-26 11:39

Menno : can you have a look at [^] and see if you reproduce ?

I have it, but TMS and Carsten don't have :snif:
User avatar (21710)
DenisChenu (developer)
2012-10-26 14:44

Think it's a EM session cache issue.
Please helper try this:

Before starting the survey : click on menu Survey properties/Survey logic files.
And after (only after) launch the survey (with the do.png image file to have newtest=Y).
User avatar (21758)
DenisChenu (developer)
2012-10-30 11:30

Can not reproduce with this survey, plese test after last patch [^]

If you can use Git : do a git pull and test again.
User avatar (21759)
DenisChenu (developer)
2012-10-30 11:34

And something other:
For me :
sum(PHQ01_SQ001.valueNAOK, PHQ02_SQ001.valueNAOK) is allway egual to 0.
Because PHQ01_SQ001.valueNAOK and PHQ02_SQ001.valueNAOK are string ("A1","A2", ...)
User avatar (21760)
helper (reporter)
2012-10-30 12:56

I am a bit perplexed at the response and the proposed fix. First, I took a look at the GIT version of the file (which is considerably larger than the one in my current version). Without doing a direct compare, I would say there is a fairly substantial difference and will wait for the release associated with this specific file rather than risk the potental affects.

Second, the assertation that this sum does not work for Shnoulle provides for some additional confusion in that this sum works fine at the question level, which would preculed itself to the fact that there are some sort of numeric values rather than the string values that Shnoulle claims.

I updated to version Version 2.00+ Build 121025 yesterday. Again, I took the "cut" the logic formula at the question and "pasted" that formula into the group with very different results. The group does not use the conditional while the question does.
User avatar (21761)
DenisChenu (developer)
2012-10-30 13:06

I test sum(PHQ01_SQ001.valueNAOK, PHQ02_SQ001.valueNAOK) in question text, and i have allways 0. And, for me, is really 0.
For example sum("A1","A3") = O and not another think.

If question can be show: can you tell me what the user select to show the question ? The bug is here : the question have not no be show, because sum can't be >3.

User avatar (21762)
DenisChenu (developer)
2012-10-30 13:07

PS: you can reopen it, but i don't understand what is the problem, the i can't take the bug :).
User avatar (21763)
helper (reporter)
2012-10-30 13:10

The simplest of question has not been answered:

Why does the forumula work at the question level while NOT working at the Group?
User avatar (21788)
helper (reporter)
2012-10-30 18:07

Updated to Version 2.00+ Build 121030 - neither question or group work with values.
User avatar (21789)
helper (reporter)
2012-10-30 18:10

I guess that the expectation here is that the "valueNAOK" would read the assessment value, while "NAOK" would read the code for the array. This would allow the flexibility to use conditional logic based on a rating rather than on a code that could be used for some other trigger.
User avatar (21793)
DenisChenu (developer)
2012-10-30 18:46
edited on: 2012-10-30 18:47

Oups .... you're right , value give assessment .... (never used this EM possibility)

Then i test again with this information (really sorry), and relevance for group seems to work.

If i select: Several days+Several days : group2 not show
If i select: More than half the days+Several days : group2 show

(allways use newtest=Y)

User avatar (21807)
TMSWhite (reporter)
2012-10-31 02:58

It looks as though assessment value is not being handled properly at all in 2.0

The attached survey (limesurvey_survey_152167.lss) works fine in 1.92, but not in 2.0. In 1.92, the Show Logic File shows the assessment values; and the .value page of the running survey shows the proper values. Neither works properly in 2.0.
User avatar (21810)
DenisChenu (developer)
2012-10-31 10:24

When i try to import you lss file i have : Property "Questions.tid" is not defined.
User avatar (21811)
helper (reporter)
2012-10-31 12:24

Uploaded the latest lsa with logic in the groups and not in the questions.
User avatar (21884)
TMSWhite (reporter)
2012-11-02 03:01

Denis, that file imports fine for me. Could you be trying to import into 2.1 instead of 2.0?
User avatar (21885)
TMSWhite (reporter)
2012-11-02 05:07

Fix committed to master branch: [^]
User avatar (21886)
TMSWhite (reporter)
2012-11-02 05:13

This patch fixes Show Logic File. Once you show logic file once, the group-by-group relevance works fine. However, if you try it before running show logic file, it does not work. So, some assessment-related parameter may be getting cached via Show Logic File.
User avatar (21893)
DenisChenu (developer)
2012-11-02 10:54


No try to import at 2.0 :
 Property "Questions.tid" is not defined.
htdocs/limesurvey_GIT/LimeSurvey/application/models/Questions.php(253): CActiveRecord->__set("tid", "0") (line 253)

htdocs/limesurvey_GIT/LimeSurvey/application/helpers/admin/import_helper.php(3610): Questions->insertRecords(array("parent_qid" => "0", "sid" => "678718", "gid" => "123", "tid" => "0", ...))
line 3610

And Yes, i don't know a tid in Question

Can you upload the tsv file ?
User avatar (21902)
c_schmitz (administrator)
2012-11-02 11:18

Fix committed to 2.1 branch: [^]
User avatar (21905)
TMSWhite (reporter)
2012-11-02 12:34


tid is only used in 2.1, and is not found anywhere in 2.0. Please checkout master and try again (forcing a clean checkout if needed).
User avatar (21911)
c_schmitz (administrator)
2012-11-02 13:40

Hello Thomas,

I don't think this is related to assessments at all - there seems to be a general caching problem with EM - as an example see issue 06808 and we have these error all over the application.

Some can be fixed by selecting another survey and going back. Some (like 06808) only by selecting the 'show survey logic' function. We really need your help on this one.
User avatar (21918)
TMSWhite (reporter)
2012-11-02 15:13

What is the preferred way to handle caching in Yii? Perhaps we can bulk switch to that aproach.
User avatar (21919)
c_schmitz (administrator)
2012-11-02 15:20

In general there is barely any caching in Yii, so I am still wondering where this comes from.

I think it has something to do with the new way the survey session is stored as these issues only seem to happen on survey taking - problem is that I don't know where to start to look. Why would looking at the survey logic resolve this issue?
User avatar (21920)
TMSWhite (reporter)
2012-11-02 15:36

2.1 might also help. I use caching because the setVariabkeAndToken function is expensive and does a lot of processing. If we avoid that runtime processing by puting those dynamic fiekda into the database at design time, we would not need as much, if any, caching.
User avatar (21935)
DenisChenu (developer)
2012-11-03 14:49


Maybe an partial fix,
Principle: when a admin launch a preview, then the survey is in testing mode. There are good chance EM is not stable, and cache is obsolete.

Then , fore EM refresh in :
_userHasPreviewAccessSession function (from controler/survey/index.php for 2.0)

PS: can do it in a fork and take some test.
User avatar (21971)
c_schmitz (administrator)
2012-11-06 09:05

It seems that this issue only happens in connecction with the administration.
I now implemented a SetDirtyFlag in killSession and it seems to work fine.

@helper: can you check out the patch from 06808 ?
User avatar (21991)
helper (reporter)
2012-11-06 13:44

I patched my local with [^] - all seems good now.

- Related Changesets
LimeSurvey: master 5a83cf58
Timestamp: 2012-11-02 03:44:05
Author: TMSWhite
Committer: Thomas White
Details ] Diff ]
Fixed issue 06768: Relevance equation works at question level but not at the group level
Dev also fixed Show Logic File so that shows assessment values when applicable
mod - application/helpers/expressions/em_manager_helper.php Diff ] File ]
LimeSurvey: 2.1 ebc4a7a8
Timestamp: 2012-11-02 03:44:05
Author: TMSWhite
Committer: c_schmitz
Committer: Carsten Schmitz
Details ] Diff ]
Fixed issue 06768: Relevance equation works at question level but not at the group level
Dev also fixed Show Logic File so that shows assessment values when applicable
mod - application/helpers/expressions/em_manager_helper.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2012-10-24 17:25 helper New Issue
2012-10-24 17:25 helper Status new => assigned
2012-10-24 17:25 helper Assigned To => TMSWhite
2012-10-24 17:25 helper File Added: limesurvey_survey_766173.lss
2012-10-24 21:30 DenisChenu Note Added: 21633
2012-10-25 06:16 TMSWhite Note Added: 21640
2012-10-25 06:16 TMSWhite Status assigned => resolved
2012-10-25 06:16 TMSWhite Resolution open => no change required
2012-10-25 13:47 helper Note Added: 21649
2012-10-25 13:47 helper Note Added: 21650
2012-10-25 13:47 helper Status resolved => feedback
2012-10-25 13:47 helper Resolution no change required => reopened
2012-10-25 13:50 helper File Added: limesurvey_survey_945857.lss
2012-10-25 13:50 helper Note Added: 21651
2012-10-25 13:50 helper Status feedback => assigned
2012-10-25 17:08 TMSWhite Note Added: 21686
2012-10-26 06:24 TMSWhite Note Added: 21693
2012-10-26 06:24 TMSWhite Assigned To TMSWhite =>
2012-10-26 06:24 TMSWhite Status assigned => new
2012-10-26 09:42 DenisChenu Assigned To => DenisChenu
2012-10-26 09:42 DenisChenu Status new => assigned
2012-10-26 10:57 mdekker Note Added: 21696
2012-10-26 11:09 DenisChenu Note Added: 21697
2012-10-26 11:13 mdekker Note Added: 21698
2012-10-26 11:15 mdekker Note Added: 21699
2012-10-26 11:27 mdekker Note Added: 21700
2012-10-26 11:38 DenisChenu Note Added: 21701
2012-10-26 11:39 DenisChenu Note Added: 21702
2012-10-26 14:44 DenisChenu Note Added: 21710
2012-10-26 14:44 DenisChenu Relationship added child of 06744
2012-10-30 11:30 DenisChenu Note Added: 21758
2012-10-30 11:34 DenisChenu Note Added: 21759
2012-10-30 11:34 DenisChenu Status assigned => resolved
2012-10-30 11:34 DenisChenu Fixed in Version => 2.00+
2012-10-30 11:34 DenisChenu Resolution reopened => fixed
2012-10-30 12:56 helper Note Added: 21760
2012-10-30 13:06 DenisChenu Note Added: 21761
2012-10-30 13:07 DenisChenu Assigned To DenisChenu =>
2012-10-30 13:07 DenisChenu Note Added: 21762
2012-10-30 13:10 helper Note Added: 21763
2012-10-30 13:10 helper Status resolved => feedback
2012-10-30 13:10 helper Resolution fixed => reopened
2012-10-30 18:07 helper Note Added: 21788
2012-10-30 18:07 helper Status feedback => new
2012-10-30 18:10 helper Note Added: 21789
2012-10-30 18:46 DenisChenu Note Added: 21793
2012-10-30 18:46 DenisChenu Note Edited: 21793 View Revisions
2012-10-30 18:47 DenisChenu Note Edited: 21793 View Revisions
2012-10-31 02:57 TMSWhite File Added: limesurvey_survey_152167.lss
2012-10-31 02:58 TMSWhite Note Added: 21807
2012-10-31 10:24 DenisChenu Note Added: 21810
2012-10-31 12:23 helper File Added: survey_archive_383498.lsa
2012-10-31 12:24 helper Note Added: 21811
2012-11-02 03:01 TMSWhite Note Added: 21884
2012-11-02 05:07 TMSWhite Changeset attached => LimeSurvey master 5a83cf58
2012-11-02 05:07 TMSWhite Note Added: 21885
2012-11-02 05:13 TMSWhite Note Added: 21886
2012-11-02 10:54 DenisChenu Note Added: 21893
2012-11-02 11:18 c_schmitz Changeset attached => LimeSurvey 2.1 ebc4a7a8
2012-11-02 11:18 c_schmitz Note Added: 21902
2012-11-02 12:34 TMSWhite Note Added: 21905
2012-11-02 13:36 c_schmitz Relationship added related to 06808
2012-11-02 13:36 c_schmitz Assigned To => c_schmitz
2012-11-02 13:36 c_schmitz Status new => assigned
2012-11-02 13:40 c_schmitz Note Added: 21911
2012-11-02 15:13 TMSWhite Note Added: 21918
2012-11-02 15:20 c_schmitz Note Added: 21919
2012-11-02 15:36 TMSWhite Note Added: 21920
2012-11-03 14:49 DenisChenu Note Added: 21935
2012-11-06 09:05 c_schmitz Note Added: 21971
2012-11-06 09:05 c_schmitz Status assigned => feedback
2012-11-06 13:44 helper Note Added: 21991
2012-11-06 13:44 helper Status feedback => assigned
2012-11-06 14:41 c_schmitz Status assigned => resolved
2012-11-06 14:41 c_schmitz Resolution reopened => fixed
2012-11-06 14:41 c_schmitz Status resolved => closed

Copyright © 2000 - 2016 MantisBT Team
Powered by Mantis Bugtracker