Welcome to the LimeSurvey Community Forum

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

relevance behaving differently: when TOKEN is numeric vs alpha-numeric

  • LeftyMaus
  • LeftyMaus's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 3 months ago #146177 by LeftyMaus
I've got a simple series of questions:
  1. (Q-Code EduNum) How many educators work at your site?
  2. (Q-Code EduLeft) How many educators have left within the last 12 months?
  3. (Q-Code EduDegree) How many educators have a Bachelor’s Degree?

I'd like to set up relevance so the first question controls whether or not the next two appear. The problem I have is that relevance is behaving differently when TOKEN is numeric vs when TOKEN is alpha-numeric. While TOKEN is alpha-numeric, everything works as expected, but once I start reviewing surveys with strictly-numeric TOKEN, the relevance no longer reacts to the first question, and the second two questions never dynamically appear.

Testing conditions:
I have just upgraded from version 2.05+ to version 2.56.1, and I don't recall having this issue in the older version. All three questions are numerical input, and all three are mandatory. For relevance, into the second two questions, I'm entering the value: EduNum. I am running Windows & Pro, and using the Waterfox browser 50.0.2. I have also tested in Chrome and I get the same behavior.

While working to debug it on my own, I discovered that if I modify the TOKEN table by adding a text character to a TOKEN, then the relevance works. For example changing TOKEN # 3461 to 3461t makes the relevance work as expected. (Needless to say the TOKEN becomes unusable because it no longer is the correct value. In my case I use a very specific TOKEN in order to mirror a database ID.)

But further testing showed a more complicated picture. I decided to re-load my TOKEN table. I deleted my current TOKEN table, modified the csv, and re-uploaded it with a new record. This new record was created by copying the record for TOKEN # 3461 exactly as is, except renamed as 3461t. However, when I preview the survey, neither 3461 nor 3461t demonstrates the correct relevance behavior.

If I return to my TOKEN table, modify a strictly-numeric TOKEN by adding an alphanumeric character, the relevance still fails. But if I promptly delete the alphanumeric character from the same TOKEN, then the relevance works.

The last bit of strangeness is that if I attempt to click "submit" while relevance is not working correctly, this somehow forces relevance to (somewhat) work again. The survey refreshes with the missing questions, complete with red-text and alerts that various questions are required.

The very painful work-around is to add an alphanumeric character, then promptly delete it from each TOKEN. I'm getting the feeling that I stumbled across a bug. But I was hoping to get some feedback before I went that route.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago #146180 by tpartner
I have no clue why the token value should affect anything unless you are using it in your relevance equation(s).

Having said that, it seems to me that your relevance equations for the second two questions should be something like:
Code:
EduNum.NAOK != ''

Or:
Code:
!is_empty(EduNum.NAOK)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • LeftyMaus
  • LeftyMaus's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 3 months ago #146181 by LeftyMaus
Before I got sucked down the TOKEN rabbit hole, I've tried a variety of relevance equations, thinking that was the source of my problems. For example:
Code:
EduNum.NAOK > "0"
EduNum.NAOK > 0
!isempty(EduNum)

But none of them bore out any success.

Eventually I will need to use TOKEN value to effect relevance. I need to expose a somewhat random group of respondents to one particular question. I plan on selecting that group by determining whether their TOKEN value is either odd or even. But unfortunately I won't be able to get that going until I work out this issue.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago #146192 by DenisChenu
There are some fixed bug about numeric value and relevance in some of 2.5X version, think all are fixed now in the last 2.57.version.

If you need : you can try to force numeric or text comparaison. Here : you don't put the relevance equation set for the token.

I use a lot :
Code:
is_empty(trim(TOKEN:ATTRIBUTE_1))
Code:
intval(TOKEN:ATTRIBUTE_1)
for example

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose