View Issue Details

IDProjectCategoryView StatusLast Update
06768Bug reports[All Projects] Expression Managerpublic2012-11-06 14:41
ReporterhelperAssigned Toc_schmitz 
Status closedResolutionfixed 
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.
TagsNo tags attached.
Complete LimeSurvey version number (& build)121024
I will donate to the project if issue is resolvedNo
Database & DB-VersionMSSQL
Operating System (Server)Windows7
Webserver software & versionApache 2.4
PHP Version5.4.7


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




2012-10-24 17:25


limesurvey_survey_766173.lss (20,484 bytes)


2012-10-24 21:30

developer   ~21633


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.


2012-10-25 06:16

reporter   ~21640

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


2012-10-25 13:47

reporter   ~21649

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.


2012-10-25 13:47

reporter   ~21650

Rechecked this morning - see note.


2012-10-25 13:50


limesurvey_survey_945857.lss (27,476 bytes)


2012-10-25 13:50

reporter   ~21651

Uploaded latest lss.


2012-10-25 17:08

reporter   ~21686

It works in all in one mode but not on group by group mode.


2012-10-26 06:24

reporter   ~21693

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.


2012-10-26 10:57

developer   ~21696

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)


2012-10-26 11:09

developer   ~21697

Thanks Menno ,

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



2012-10-26 11:13

developer   ~21698

complete survey, also attached survey here seems to work


2012-10-26 11:15

developer   ~21699

in runtime i get an error on the attached 945857


2012-10-26 11:27

developer   ~21700

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.


2012-10-26 11:38

developer   ~21701

Argllll .... an EM cache issue ;)


2012-10-26 11:39

developer   ~21702

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

I have it, but TMS and Carsten don't have :snif:


2012-10-26 14:44

developer   ~21710

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).


2012-10-30 11:30

developer   ~21758

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

If you can use Git : do a git pull and test again.


2012-10-30 11:34

developer   ~21759

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", ...)


2012-10-30 12:56

reporter   ~21760

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.


2012-10-30 13:06

developer   ~21761

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.



2012-10-30 13:07

developer   ~21762

PS: you can reopen it, but i don't understand what is the problem, the i can't take the bug :).


2012-10-30 13:10

reporter   ~21763

The simplest of question has not been answered:

Why does the forumula work at the question level while NOT working at the Group?


2012-10-30 18:07

reporter   ~21788

Updated to Version 2.00+ Build 121030 - neither question or group work with values.


2012-10-30 18:10

reporter   ~21789

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.


2012-10-30 18:46

developer   ~21793

Last edited: 2012-10-30 18:47

View 3 revisions

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)



2012-10-31 02:57


limesurvey_survey_152167.lss (282,132 bytes)


2012-10-31 02:58

reporter   ~21807

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.


2012-10-31 10:24

developer   ~21810

When i try to import you lss file i have : Property "Questions.tid" is not defined.


2012-10-31 12:23


survey_archive_383498.lsa (5,767 bytes)


2012-10-31 12:24

reporter   ~21811

Uploaded the latest lsa with logic in the groups and not in the questions.


2012-11-02 03:01

reporter   ~21884

Denis, that file imports fine for me. Could you be trying to import into 2.1 instead of 2.0?


2012-11-02 05:07

reporter   ~21885

Fix committed to master branch:


2012-11-02 05:13

reporter   ~21886

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.


2012-11-02 10:54

developer   ~21893


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 ?


2012-11-02 11:18

administrator   ~21902

Fix committed to 2.1 branch:


2012-11-02 12:34

reporter   ~21905


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).


2012-11-02 13:40

administrator   ~21911

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.


2012-11-02 15:13

reporter   ~21918

What is the preferred way to handle caching in Yii? Perhaps we can bulk switch to that aproach.


2012-11-02 15:20

administrator   ~21919

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?


2012-11-02 15:36

reporter   ~21920

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.


2012-11-03 14:49

developer   ~21935


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.


2012-11-06 09:05

administrator   ~21971

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 ?


2012-11-06 13:44

reporter   ~21991

I patched my local with - all seems good now.

Related Changesets

LimeSurvey: master 5a83cf58

2012-11-02 03:44:05


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

2012-11-02 03:44:05


Committer: c_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