Welcome to the LimeSurvey Community Forum

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

export token field in open access surveys

  • jonytrifulca
  • jonytrifulca's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 3 months ago #223735 by jonytrifulca
export token field in open access surveys was created by jonytrifulca
Hi first question here.
I'm working on a survey mode where surveys are open and I provide the token in the url from outside, as I see token is stored in database in the field token with the corresponding results.
The doubt is: There are any way to export this token field in an open-access mode survey? It seems not appearing in the available columns to export.

Thanks in advance.

Please help us help you and fill where relevant:
Your LimeSurvey version: [url=https://127.0.0.1/ls/index.php/admin/export/sa/exportresults/surveyid/975315/id/1#modalSystemInformation]Version 5.2.9+220110[/url]
 
Attachments:
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago #223739 by holch
Replied by holch on topic export token field in open access surveys
If you provide the token from the URL from outside, you need to save it somewhere. Seems like you did not create a token table in Limesurvey, right? Then you need to save your external token/ID/whatever you want to call it in a hidden question, otherwise it will not be stored in the database.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • jonytrifulca
  • jonytrifulca's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 3 months ago #223742 by jonytrifulca
Replied by jonytrifulca on topic export token field in open access surveys
Hi holch, thanks for your answer.
Yes I provide the token from outside in the url and I can see how it is stored in the answers rows in the database. See attached image. But the column "token" does not appear to be exportable in the export responses assistant.
 
Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago - 2 years 3 months ago #223752 by Joffm
Replied by Joffm on topic export token field in open access surveys
Hi, I think there are some misunderstandings

2. The field "token" in the database table "lime_survey_XXXXXX" is only an internal key field to establish a relation to the token table "lime_token_XXXXXX".

lime_token_XXXXXX
 

lime_survey_XXXXXX
 

But in an open survey THERE IS NO token table.
And in the export the data of the token table are exported.

2. This field in the "survey" table usually is NULL in open surveys.
But now you misuse the "reserved" word "token" as parameter.
Now this happens as you read here
[url] manual.limesurvey.org/URL_fields/en#Start_URL [/url]
The field "token" is preset by the value of the parameter, exactly as a question with code "Q1" would be by a parameter called "Q1".

Conclusion:
As you were told before: If you want to add a parameter you have to create a (hidden) question with the same name as the parameter (NOT "token") of an appropriate type (preferable "short text") where the value of the parmeter is stored. 

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 3 months ago by Joffm.
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago #223761 by holch
Replied by holch on topic export token field in open access surveys

Yes I provide the token from outside in the url and I can see how it is stored in the answers rows in the database. See attached image.

This sounds odd. How do you get this token if your survey is in open access mode? Because in this case, there is no token / participant table, thus there is no token. How the heck do you get the token into this table and where does this token come from?

But the column "token" does not appear to be exportable in the export responses assistant.


As it should! As you have a open access mode survey there is no token table / participant table and no token.

So please explain what you are doing, where this token is coming from, if your survey is really a open access mode survey, if you did create a participant table, etc.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago #223767 by Joffm
Replied by Joffm on topic export token field in open access surveys
Well, the field "token" is there in "lime_survey_123123" and it is either NULL in open or closed anonymous surveys or populated with the token:token.
But is only used as key field for the token in "lime_token_123123".

And you can call it a glitch, that LS populates this field by an additional parameter in the start URL.
Meaning:
"...?lang=en&token=ABC" stores ABC in "token" exactly as "...?lang=en&Q1=XYZ" stores XYZ in question Q1.

Therefore you must not use the word "token" as additional parameter if it is not a closed survey.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago #223769 by holch
Replied by holch on topic export token field in open access surveys
@Joffm: Ahh, so if you pass "token" via the URL it gets stored as if it would be a token in Limesurvey? Interesting. I thought without a token table initialized you would need to have a question with the name "token" to save it.

But I already expected something like that, just didn't have the time to test it.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • jonytrifulca
  • jonytrifulca's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 3 months ago #224091 by jonytrifulca
Replied by jonytrifulca on topic export token field in open access surveys
Hi Joffm and Holch and thanks you again for your information.

I agree with Joffm that use the token field is not the right behaviour here, I agree with the fact that I am misusing the "reserved" word "token" as parameter and the right solution would be add a parameter as a hidden question a fill it in the url.

The problem here is that there are third people how is going to be in charge of creating surveys and I have no guarantees that they follow the rules of creating a hidden question as the right way.

So, in my case, the only solution as I see is the misuse of the "token" field of an open survey in the url by this moment.

Meanwhile I found another cleaner solution (like automatically add a hidden question in the survey creation or something like that) I have set the token as exportable in the open access survey export section by adding the code:

$aFields["token"] = "token - token";

in the line 209 of the file :application/controllers/admin/export.php

in LS Version 5.2.9+220110

I now that is not the best one, obviously I could have troubles in updates and something like that, but by now updates are frozen in this systems.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 2 months ago #224157 by DenisChenu
Replied by DenisChenu on topic export token field in open access surveys
Hi,

Yes : if survey is  not set as anonymous : token column is always created.
I don't think we can fill wityh start url, but seems the case. Good or not ? I don't know …

Else : my opinion : if token column exist in the database : it must be allowed to export in all condition … token table or not.
Why :
1. because maybe token table exist at start of survey  for example.
2. a plugin systme fill the token.
3. Why export seed if we can not export token …

Must be reported as issue (for LTS too) community.limesurvey.org/bug-tracker/

Without updating LimeSurye core : you have it in VV export

 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose