Welcome to the LimeSurvey Community Forum

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

Problem assigning question value with Join or if

  • walace
  • walace's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 1 day ago - 1 month 1 day ago #259023 by walace
Please help us help you and fill where relevant: 
Your LimeSurvey version: 6.4.10+240228 
Own server or LimeSurvey hosting: On Server 
Survey theme/template:  fruity_twentythree
==================Hello friends,Firstly, I would like to thank you immensely for the work done at LimeSurvey, the world is a better place thanks to you. I have managed to get along well with the forums, but I have a problem with an expression that I am unable to overcome, so I humbly ask for your help. Every help is welcome. Details below. I have a survey to evaluate performance, where the user must first select the store (G01Q16) and, depending on the store chosen, the next question will be displayed (G01Q15 or G01Q19) containing only sellers who belong to the selected store. Then the user selects the desired seller. So far everything works fine. My next objective would be to obtain the selected seller and assign it to the Evaluated Seller question (G01Q11), which would obtain the selected seller regardless of the chosen store, with a function-type question with the following expression.
Code:
join(if(G01Q16.NAOK == '0001', G01Q11 = G01Q15.shown), if(G01Q16.NAOK == '0002', G01Q11 = G01Q19.shown))

Here is my problem: The assignment only works as expected when the user selects store '0002' in store '0001' does not work.
The same problem also occurs if I am using ifs.
Code:
{if(G01Q16.NAOK=='0001',G01Q11=G01Q10.shown,if(G01Q16.NAOK=='0002',G01Q11=G01Q15.sho
wn)} In both cases I reviewed the syntax, and it appears to be ok.Could you please help me overcome this obstacle? Thank you very much in advance.
Below is an example of research where I simulate the problem
Last edit: 1 month 1 day ago by walace.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 day ago #259026 by Joffm
Hi,
what for the "join"? There are only single questions. And you want a single answer
So this is sufficient

{G01Q11=if(G01Q16.NAOK=='0001',G01Q15.shown,if(G01Q16.NAOK=='0002',G01Q19.shown,''))}




But not on the same page.

Joffm

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

Please Log in to join the conversation.

  • walace
  • walace's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 1 day ago #259032 by walace
Very good!!!
Firstly, thank you for the quick response.
Secondly, it worked perfectly!!!!

It seems that I was failing to understand if. In fact, the function returns a value that I can assign to a variable. I was mistakenly trying to assign the value within the function.

Joff, thank you very much!!! Your collaboration makes the world a better place every day!

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose