Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Toke persistence / relevance equation issue

  • joeschwab
  • joeschwab's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 5 months ago #231563 by joeschwab
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.18.0+190923
Own server or LimeSurvey hosting: CentOS
Survey theme/template: fruity
==================

Howdy fine lime survey folks!

We have surveys using closed access mode with tokens based persistance  with a relevance equation on each survey group to screen out participants who fail to correctly answer theer correct date of birth stored as a token attribute.

QDateofBirth.NAOK == TOKEN:ATTRIBUTE_2

If a participant completes the survey in one session, everything works fine. If the participant leaves the survey and returns using their token at any point before QDateofBirth, they are able to proceed to QDateofBirth and finish the survey normally (within a single session).

However, when a participant leaves the survey after having answered the QDateofBirth question, and returns to finish later using their survey link (with token), the relevancy equation fails, sending them to the end screen.

I am able to display the value {QDateofBirth} in the end screen to verify the value was saved.

Does anyone have an ideas about why this relevance equation would fail upon returning to the survey?

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 5 months ago #231574 by tpartner
Replied by tpartner on topic Toke persistence / relevance equation issue
Try screening out with a quota instead of relevance.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • joeschwab
  • joeschwab's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 5 months ago #231600 by joeschwab
Replied by joeschwab on topic Toke persistence / relevance equation issue
Thanks for your response.

How would I go about creating a quota that compares a question response to a value stored in a token attribute?

I have only a basic understanding of using quotas. I am not seeing a way to do this.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 4 months ago #231626 by tpartner
Replied by tpartner on topic Toke persistence / relevance equation issue
A basic example where, for example, we set a quota of 0, comparing a question with code Q1 to TOKEN:ATTRIBUTE_1...

1) Add a hidden (via CSS class) equation type question, code "screenout", with this as a value:

Code:
{if(Q1 == TOKEN:ATTRIBUTE_1, 'no', 'yes')}



2) Add a quota with a limit of 0 based on "screenout".



Sample survey attached: 

File Attachment:

File Name: limesurvey...3293.lss
File Size:17 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 4 months ago #231636 by holch

Add a hidden (via CSS class) equation


As this is an equation and it is not used via Javascript, shouldn't it also be possible to hide it via "always hide this question"?

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 4 months ago #231659 by tpartner
Replied by tpartner on topic Toke persistence / relevance equation issue

As this is an equation and it is not used via Javascript, shouldn't it also be possible to hide it via "always hide this question"?

I prefer hiding these questions with CSS to ease testing/debugging.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: holch

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 4 months ago #231662 by holch

I prefer hiding these questions with CSS to ease testing/debugging.


Understood. I prefer it the other way round though. ;-)

I prefer to hide everything that can be hidden via GUI via GUI, as it won't even appear in the source code (some participants can be sneaky...).

Just wanted to make sure that there is technical reason not to use the GUI.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • joeschwab
  • joeschwab's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 4 months ago #231747 by joeschwab
Replied by joeschwab on topic Toke persistence / relevance equation issue
Thanks for all the responses. I'm always impressed with this community.

After reworking the logic to use a quota instead of relevance equations, I figured out that the date format comparison in my relevancy equation was failing due to a difference in date format between the same session, and then upon returning to the survey later.

For example, when I display the input question's date format during the session with {QDateofBirth}, it shows like: 2006-01-01. However, when returning to the survey at a later time, the question's value is retrieved and displayed in the format: 2006-01-01 00:00. 

So ultimately my solution came down to using the strtotime function to format both the question response and the token value to make sure they are the same format like:
{if(date("Y-m-d", strtotime(QDateofBirth)) == date("Y-m-d", strtotime(TOKEN:ATTRIBUTE_2)),"True", "False")}
The following user(s) said Thank You: tpartner

Please Log in to join the conversation.

More
2 years 4 months ago #231759 by jelo

For example, when I display the input question's date format during the session with {QDateofBirth}, it shows like: 2006-01-01. However, when returning to the survey at a later time, the question's value is retrieved and displayed in the format: 2006-01-01 00:00.
 
When reading this I would call this a bug.  Or is there a different way to see it?
 

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 4 months ago #231761 by tpartner
Replied by tpartner on topic Toke persistence / relevance equation issue
Yeah, it should be consistent regardless of when viewed.

Joe, can you please file a bug report giving full details of use-case, environment, etc?

- bugs.limesurvey.org/

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • joeschwab
  • joeschwab's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 4 months ago #231783 by joeschwab
Replied by joeschwab on topic Toke persistence / relevance equation issue
Sure. Although im using an older version (Version 3.18.0+190923). Its possibly not an issue on newer versions?

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 4 months ago #231829 by tpartner
Replied by tpartner on topic Toke persistence / relevance equation issue
Can you test a survey at on the demo site?

- demo.limesurvey.org/index.php?r=admin/

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose