Default answer not picking update a previous answers

More
6 months 2 weeks ago #151836 by C123
C123 created the topic: Default answer not picking update a previous answers
I have a question that has a default answer that depends on the answer given earlier in the survey. However, this does not pull through. Here is the statement I'm using;

if(is_empty(DP1Q1), 'This question has not been answered', 'This question has been answered')


The odd thing is if I put the same statement in the question body it pulls through correctly. So the question body says that they have answered the question and the default answer says that they have not. Does anybody have any ideas?

Thanks in advance.

Please Log in to join the conversation.

More
6 months 2 weeks ago #151842 by jelo
jelo replied the topic: Default answer not picking update a previous answers

C123 wrote: I have a question that has a default answer that depends on the answer given earlier in the survey.

What questiontype should be assigned a default answer.
Assigning a Textstring "This question has not been answered" as a value for a default answer seems not correct.Most common would be an answer or questioncode, but not a written text.

manual.limesurvey.org/Expression_Manager#Access_to_Variables

Export these two questions as a survey and attach it here.

Please Log in to join the conversation.

More
6 months 2 weeks ago - 6 months 2 weeks ago #151844 by C123
C123 replied the topic: Default answer not picking update a previous answers
Hi

Thanks for reading I've attached the two questions.

It is a work in progress and the text will be different once it finished, I'm just trying to get the basic mechanics working at the moment.

I did try using question codes but I get a similar error where the default answer is blank but if I use the code in the question body it works.
Attachments:
Last Edit: 6 months 2 weeks ago by C123. Reason: Wrong file

Please Log in to join the conversation.

More
6 months 2 weeks ago #151855 by jelo
jelo replied the topic: Default answer not picking update a previous answers
What version of LimeSurvey is used? Since you use a textfield you can assign text the way you do it.
{if(is_empty(DP1Q100),'This question has not been answered','This question has been answered')}



It's working. I only edited the textfield, but didn't change anything. The DP1Q1 is your post was DP1Q100 in your export. So no change by me. Perhaps you try again and check every variable. Perhaps you fixed it already.
Attachments:

Please Log in to join the conversation.

More
6 months 2 weeks ago #151857 by C123
C123 replied the topic: Default answer not picking update a previous answers
Hi

Thanks for having look, I'll have to investigate further as I still get the error when I select an answer (see below)

Attachments:

Please Log in to join the conversation.

More
6 months 2 weeks ago #151866 by jelo
jelo replied the topic: Default answer not picking update a previous answers
That is no error, the default answer will not change dynamically once you got the answer shown.
You might consider placing the answer on another page. That might will update the default answer.

Please Log in to join the conversation.

More
6 months 2 weeks ago #151869 by C123
C123 replied the topic: Default answer not picking update a previous answers
I should have mentioned that they these are in different groups it is set to show a group a page. However, I have got full jumping turned on would that make a difference?

Please Log in to join the conversation.

More
6 months 2 weeks ago #151873 by jelo
jelo replied the topic: Default answer not picking update a previous answers

C123 wrote: However, I have got full jumping turned on would that make a difference?

Fulljumping? I don't understand.

The default answer can only be set once, when the question is displayed.

Best approach using Limesurvey is using Group by Group mode.
Place the question in one group and the text question with the default answer expression in the next group. The default answer will be shown correctly.

If not, export a survey structure instead of single questions files.
The following user(s) said Thank You: C123

Please Log in to join the conversation.

More
6 months 2 weeks ago #151889 by C123
C123 replied the topic: Default answer not picking update a previous answers
Thanks, for your help I think I understand now, even though I'm using the group by group mode because I've got full navigation turned on once the group with the default answer group is visited it won't change even if the user goes back and changes the other answer.

Please Log in to join the conversation.

More
6 months 2 weeks ago #151900 by tpartner
tpartner replied the topic: Default answer not picking update a previous answers
It sounds to me that in order to have this dynamic, rather than using the default answer setting, you should be using an equation question with the Expression Manager assignment operator to set the question.

Some notes:

1) The equation question is best placed in a group following that of the question to be manipulated.
2) The equation question must be place in a group that will always be seen (not skipped via relevance).

manual.limesurvey.org/Expression_Manager#Operators

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
6 months 2 weeks ago #151906 by jelo
jelo replied the topic: Default answer not picking update a previous answers

C123 wrote: it won't change even if the user goes back and changes the other answer.

Correct, that is intended behavior (at least it works like this since default answers were introduced). Post a small export of two groups here. We can try the assignment as tpartner suggested.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now