Welcome to the LimeSurvey Community Forum

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

Rewrite variable by syntax in question/code

  • MC_EMC23
  • MC_EMC23's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 3 days ago #261101 by MC_EMC23
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Dear All,
I am currently using Limesurvey 2.06. I realize that this is a very old version in limesurvey but I do not have another option right now.

I have trouble with a syntax that we want to use to rewrite a variable. We are using a if statement. If FIP1_13 question == A2 -> then variable: Implantaat13=""(should be emptied). Else -> nothing should happen and Implantaat13 should remain the same value as before.

However, this syntax now erases/empties the value of Implantaat13. Am I using the operator syntax wrong or is there another way to rewrite a variable?

Best,

Milton

 
Attachments:

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 2 days ago - 1 week 2 days ago #261113 by holch

However, this syntax now erases/empties the value of Implantaat13.


Your syntax is currently this (always better to post the exact syntax than a screenshot, as we can work with it):
Code:
if(FIP1_13=="A2", Implantaat13="", "")


So what does your syntax do?

1. it checks if FIP1_13 iguals A2.
2. if it does igual A2 you change Implantaat13 to empty.
3. the last part is the tricky one. To check what happens it would be great to have small sample survey.

So if I understand your issue correctly, Implantaat13 is ALWAYS set to empty? Because this wasn't clear from your request.

What happens when you put for the "else" part something like that: "Implantaat13=Implantaat13"?
Code:
if(FIP1_13=="A2", Implantaat13="", Implantaat13=Implantaat13)

In my opinion, your syntax should work and not result in an empty Implantaat13 if FIP1_13 is NOT A2. But your version is ancient and not supported anymore. I couldn't even test if this is a bug because I don't have such an old installatin anymore. This version hasn't received bug fixes, security patches or updates for many, many years.

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

Last edit: 1 week 2 days ago by holch.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 2 days ago #261115 by Joffm
I prefer a different syntax.
{Implantaat13=if(FIP1_13=="A2","",Implantaat13)}

Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, holch, MC_EMC23

Please Log in to join the conversation.

  • MC_EMC23
  • MC_EMC23's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 2 days ago #261137 by MC_EMC23
Replied by MC_EMC23 on topic Rewrite variable by syntax in question/code
Dear Joffm
Thank you! it works!
I still do not understand why my syntax did not work, might be due to the old version of limesurvey?

Best
Milton

Please Log in to join the conversation.

  • MC_EMC23
  • MC_EMC23's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 2 days ago #261139 by MC_EMC23
Replied by MC_EMC23 on topic Rewrite variable by syntax in question/code
Dear Holch,
Thank you for the reply. I checked and the syntax still gives an empty value regardless of the input.
The syntax from Joffm: {Implantaat13=if(FIP1_13=="A2","",Implantaat13)} works for me!

Best 

Milton

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 2 days ago #261179 by DenisChenu
Replied by DenisChenu on topic Rewrite variable by syntax in question/code

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.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose