Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Create and use global variable in questions

Create and use global variable in questions 2 Jahre 3 Wochen her #87920

  • bhessen
  • bhessens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Karma: 0
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.
Letzte Änderung: 2 Jahre 3 Wochen her von bhessen.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Create and use global variable in questions 2 Jahre 2 Wochen her #87936

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6561
  • Dank erhalten: 872
  • Karma: 257
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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Aw: Create and use global variable in questions 2 Jahre 2 Wochen her #87941

  • bhessen
  • bhessens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Karma: 0
Thanks a lot. The actual code was:

{date("Y")} (otherwise, the year will be printed 2 times)
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Aw: Create and use global variable in questions 2 Jahre 2 Wochen her #87983

  • bhessen
  • bhessens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Karma: 0
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?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Aw: Create and use global variable in questions 2 Jahre 2 Wochen her #87999

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6561
  • Dank erhalten: 872
  • Karma: 257
Not sure,

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

Denis
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Aw: Create and use global variable in questions 2 Jahre 2 Wochen her #88009

  • bhessen
  • bhessens Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Karma: 0
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
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Aw: Create and use global variable in questions 2 Jahre 2 Wochen her #88026

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6561
  • Dank erhalten: 872
  • Karma: 257
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.
Letzte Änderung: 2 Jahre 2 Wochen her von DenisChenu.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.135 Sekunden
Donation Image