Check out the LimeSurvey source code on GitHub!

Controlling question display with Relevance Attribute and ExpressionManager

5 years 7 months ago #63541 by TMSWhite
The key components of ExpressionManager are now completed for non-dynamic use (in the limesurvey_dev_tms branch). Complex equations can be used to specify whether questions should be shown as long as the values in that equation are not changed on the page. Work is starting on making Relevance as dynamic as conditions (e.g. making the equations work in JavaScript).

Briefly, here's how it works:
(1) All questions now have a "Relevance" Question Attribute with a default value of 1. This should be an equation that evaluates to a Boolean result.
(2) For each question in a group, if the question is not Relevant, then:
(a) No part of the question will be written to the generated HTML file
(b) The value will not be changed (e.g. it will not be set to Not Applicable)
(3) If the question is Relevant (or there is no Relevance attribute set), the question will be displayed (unless conditions make it invisible).
(4) If there are no relevant questions in a group, then the entire group will be skipped
(5) If there are no relevant questions in the last group, then the results will be automatically submitted and the respondent will advance to the End Message
(6) If the question is irrelevant, then the question is skipped even if it is Mandatory

More details can be found at these links: ExpressionManager , Relevance , Equation Question Type

Key questions for the developer community now include:
(1) Should the responses to irrelevant questions NULLed out?
(a) Always, or only when $deletenonvalues==true?
(b) What is the preferred way to deleting the value from $_SESSION[SGQA]? unset($_SESSION[SGQA])? $_SESSION[SGQA]=''?
(2) Relevance could let a survey finish quickly - e.g. don't ask the last 10 groups of questions if the subject is a minor. However, in such cases, the subject will not see the Submit button since that is only present on the last Group.
(a) Is that behavior acceptable, or should the system try to detect that all future groups would be irrelevant and in such cases make the Submit Button visible?
(3) For questions that could never be visible on the page, should no part of that question be written to the HTML, or should some of the <hidden> fields be written?

Please Log in to join the conversation.

5 years 6 months ago #63886 by TMSWhite
ExpressionManager is now operational in the limesurvey_dev_tms branch. This includes dynamic on-current-page Assessments, conditions, and tailoring (e.g. change the value of some questions or boilerplate text displays as you type responses to other questions)

More information can be found on the wiki page [url=http://]here[/url].

Please Log in to join the conversation.

5 years 6 months ago #63938 by TMSWhite
Attached is a 2 page Demo of ExpressionManager that shows how it supports dynamic (e.g. on the current page):
  1. Calculations, Assessments & Reports - Page 1 shows many math facts for the numbers as you enter them
  2. Conditional Relevance (e.g. complex conditions) with cascading - Page 2 conditionally asks questions about your age, marital status, and number of children, but only showing potentially relevant questions based upon your age and prior responses
  3. Conditional Micro-Tailoring - Page 2 provides a running commentary about the information you entered at the bottom of the page
  4. Blanking out Non-Applicable (e.g. irrelevant) responses. Page 2 shows that if you first enter an adult age and information about children, then change the entered age to 4, all of the questions that depend upon age get blanked out. This feature is used to support cascading logic in the Relevance equations so that you don't have to attach all relevance criteria to each question.

File Attachment:

File Name: Expression...Demo.lss
File Size:64 KB

Please Log in to join the conversation.

5 years 6 months ago #63940 by holch
This will only work with the development branch, right?

By the way: From what I have seen, this ExpressionManager seems to be incredible. Can't wait for the first Demo to play around with it.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

5 years 6 months ago #63941 by TMSWhite
This only works in the limesurvey_dev_tms branch. Details for accessing it are on the wiki here

That branch is operational, so feel free to play with the Demo and create others.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form