Use variables (eg. username) in survey

More
9 months 3 weeks ago #174584 by juppix
Hi all,

I want to create a pesonalized welcome page. Something like:

"Welcome {username}!"

Is it possible to use variables from the attendees list?
user firstname, lastname, email...

thanks
jup

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
9 months 3 weeks ago #174585 by holch
Have a look at the participant table, tokens and custom attributes.

You can create custom attributes, upload the list as CSV and display these custom attributes via Expression Manager in the survey.

Have a look at micro tayloring in the manual regarding the Expression Manager.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: juppix

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174587 by juppix
Great! But is it also possible to use this variables as prefilled answers? As a proposed answer?

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174588 by holch
What do you mean with "prefilled answer", proposed answer?

Do you mean e.g. number of children. You have the number of children in the database, so you want to put this as the default answer? This is also possible, but depends a little bit on the question type you are using.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174589 by juppix
Yes ! I mean this!
Could you explain your answer a bit?

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174591 by juppix
Okay. I tried it and it works.
BUT: I want that users can reopen their survey and change the informations filled in before.
Now, if I use a {TOKEN:FIRSTNAME} as suggested answer, I would get always the info from the database.
Is it possible to check wether the user answered this question before? if so there should appear the user input text - not the database text.
you know what I mean?

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174593 by jelo
You will need to use ExpressionManager (which is a Script language, soon called ExpressionScript).
But depending on the questions, where you want to assign default values, it might be a bit tricky.
If the question has a default answer value, you might check via is_empty on the fieldcontent.
Can you provide a simple survey as an example (lss export)?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174595 by DenisChenu
For last name etc (text question), directly use {TOKEN:LASTNAME} in default value.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174598 by juppix
Okay... please find the file attached :)
Attachments:

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174631 by juppix
Hi !
I tried everything - no result :-/

My formula:

{if(is_empty(kontaktinfos.SQ001),"",{TOKEN:ATTRIBUTE_8})}

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174632 by DenisChenu
Because it must be
{if(is_empty(kontaktinfos.SQ001),TOKEN:ATTRIBUTE_8,kontaktinfos.SQ001)}
in an equation question type

But : use manual.limesurvey.org/Default_answers for short text

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174651 by juppix
Thanks! But the input field is empty :-(
Please take a look at the screenhot (attachment).
Attachments:

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174655 by holch
I am actually not quite sure what you are trying to do here. Could you explain again what exactly should be happening?

Because the code you wrote checks if the field is empty.

If the field is empty it should write "Leer" (Empty) and if there is already something in there it would write "Gefüllt" (filled). So in the later case it would actually overwrite what is in the field and write "Gefüllt" over it.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174656 by jelo
Attach your current survey to check for errors. Might be a issue with LimeSurvey, might be a little mistype. Which version of LimeSurvey is used?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #174658 by juppix
I have addidition fields in the database (Additional user infos).

If have some questions and I want that a user could re-open his survey (edit fields after submitting survey).

If a user opens the survey first time I want to provide a "predicted"/prefilled answer (from the database).
Then the user can usethis predicted/prefilled answer or could insert another answer. After that he submitts the survey again.
If he re-opens his survey he should get his old values as answers (not stored from the database).
I hope I could explain it correctly. Or better: read the first 3-4 posts of this topic to understand what I mean ;)

VERSION:
Version 3.14.10+180924

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!