Welcome to the LimeSurvey Community Forum

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

expression script numeric variable stored as string when applying division

  • equilibrium_21
  • equilibrium_21's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 4 months ago #244253 by equilibrium_21
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.25
Own server or LimeSurvey hosting: own
Survey theme/template: fruity theme
==================
Hi Forum,
I'm currently working on a survey where I want to make some calculations in expression script. In one variable, I'm applying a simple division, e.g.: Q1_SQ001/Q2_SQ001. Later, I wanted to sum this value to others, but the result was always 0. By using the is_string() function, I found out that Result of the Variable actually gets stored as a string. Does anyone know why this happens, or how to change this?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 4 months ago #244255 by Joffm
It's always better to send a lss export of these questions.

Now we have to guess which question types are Q1 and Q2,
​​​​​​ how exactly you implemented this.

Please, ease our life, help us to help you.

Joffm 

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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 4 months ago #244269 by Joffm
Sorry, but without your lss export it is not possible to answer.

I tried to built a survey according to your explanation.
 

Now I calculate:
Q1_SQ001/Q2_SQ001
and then I add Q1_SQ002 to this result.

Everything is fine.
 

What do you do?

Joffm
 

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

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose