Create and use global variable in questions

More
4 years 4 months ago - 4 years 4 months ago #87920 by bhessen
Hi,

I have a survey which is copied each year. I have a lot of questions with the current year in it. It is a lot of hassle and effort and very error prone to change all the questions to the correct year each time.

Is it possible to create a global variable and use this in the questions? Then, I would only have to change the correct year once.

Or maybe there is another way of doing this?

Thanks a lot in advance.
Last Edit: 4 years 4 months ago by bhessen.

Please Log in to join the conversation.

More
4 years 4 months ago #87936 by DenisChenu
Hello,
Use an equation question type.

Give the code ACTUALYEAR for question, and put "what you want" in question text.
After, you can use {ACTUALYEAR} in your questio text to be replaced with the actual year.

For the actual year, you have alternative automatic solution:
try {date("YY")}

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
4 years 4 months ago #87941 by bhessen
Thanks a lot. The actual code was:

{date("Y")} (otherwise, the year will be printed 2 times)

Please Log in to join the conversation.

More
4 years 4 months ago #87983 by bhessen
Hi,

this works fine for each question which comes after the ACTUALYEAR question. But I also want to use this in the description of the survey.

Is this possible?

Please Log in to join the conversation.

More
4 years 4 months ago #87999 by DenisChenu
Not sure,

But think you can use {date("Y")} in description of the survey (maybe title too).

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
4 years 4 months ago #88009 by bhessen
Ok, that is not very nice, but doable.

But I just noticed that it is all rather futile, because it does not work at all if you use the printable version :S, which I need...

Any ideas other than editing the resulting html file? I would like to have a robust process.

Ben

Please Log in to join the conversation.

More
4 years 4 months ago - 4 years 4 months ago #88026 by DenisChenu
There are a bug reporting for printable version, but i think it's only for Token information.

And i think it's difficult to know if EM need recalculation or not.

Feel free to report a bug for this.

Denis
PS: why is not very nice ? To have the actual year, you have to do some calculation.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
Last Edit: 4 years 4 months ago by DenisChenu.

Please Log in to join the conversation.