- Posts: 3
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
1 week 5 days ago #261101
by MC_EMC23
Rewrite variable by syntax in question/code was created 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
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11681
- Thank you received: 2748
1 week 5 days ago - 1 week 5 days ago #261113
by holch
Your syntax is currently this (always better to post the exact syntax than a screenshot, as we can work with it):
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"?
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.
Replied by holch on topic Rewrite variable by syntax in question/code
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 5 days ago by holch.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12997
- Thank you received: 3999
1 week 5 days ago #261115
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Rewrite variable by syntax in question/code
I prefer a different syntax.
{Implantaat13=if(FIP1_13=="A2","",Implantaat13)}
Joffm
{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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
1 week 4 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
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
1 week 4 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
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13677
- Thank you received: 2496
1 week 4 days ago #261179
by DenisChenu
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.
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.