Welcome to the LimeSurvey Community Forum

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

Floats turn into non-numeric variables?

  • marco.meyer
  • marco.meyer's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 1 month ago #231944 by marco.meyer
Floats turn into non-numeric variables? was created by marco.meyer
Please help us help you and fill where relevant:
Your LimeSurvey version: 2.62.2+170203
Own server or LimeSurvey hosting: Hosted by Uni Hamburg
Survey theme/template: Uni Hamburg Theme
==================

Hi, I am trying to use the expression manager to do an assessment in LimeSurvey, in two steps. 

First, I create a new variable with an equation: 
Code:
sum([url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ001.NAOK[/url], [url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ002.NAOK[/url], [url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ003.NAOK[/url], if(is_empty([url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ004[/url]), 0, 8 - [url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ004.NAOK[/url]), [url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ005.NAOK[/url]) / count([url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ001.NAOK[/url], [url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ002.NAOK[/url], [url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ003.NAOK[/url], [url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ004.NAOK[/url], [url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1160629]indopenminded_SQ005.NAOK[/url])

This produced the right result during the survey -- the individual questions are likert scale questions, so result is int or float (say 2, or 2,2)

Now At the end of the survey I want to do calculations with the thus created variables, e.g: simple things like 
Code:
round([url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1161290]calcindopenminded.value[/url], 1) 
.

This works as long as the variable contains an integer. If it is a float, I end up with NaN results -- and 
Code:
is_numeric([url=https://www.limesurvey.uni-hamburg.de/index.php/admin/questions/sa/view/surveyid/788825/gid/94914/qid/1161290]calcindopenminded[/url])
is true only if the variable contains an int, and false if it is a float. 

I'd very much appreciate help how to rectify this -- how can I make sure that the result of creating the variable above is a float variable, not a string?

Thank you very much in advance!

 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #231946 by Joffm
Replied by Joffm on topic Floats turn into non-numeric variables?
Hi, what is this?
Some mess, I suppose.

Better you send the survey as lss export.

Joffm

And, as I do not like to talk with a language gap without need you may consider to ask this in the Germen part.
It is a very sinple thing.

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
2 years 1 month ago #231949 by DenisChenu
Replied by DenisChenu on topic Floats turn into non-numeric variables?
Your LimeSurvey version: 2.62.2+170203

… … potential issue

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: holch

Please Log in to join the conversation.

  • marco.meyer
  • marco.meyer's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 1 month ago #231951 by marco.meyer
Replied by marco.meyer on topic Floats turn into non-numeric variables?
Thank you Joffm, I have re-posted in the German channel.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #231955 by holch
Replied by holch on topic Floats turn into non-numeric variables?

Your LimeSurvey version: 2.62.2+170203

… … potential issue


Agreed. This should not be in the wild anymore.

5,5 years without any security or bug fix and not even the latest version of this branch, which I never actually considered stable or usable for production.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose