Welcome to the LimeSurvey Community Forum

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

Can I get Question ID in my returned responses object ?

  • Bromatello
  • Bromatello's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago #190875 by Bromatello
Hi there,
I'm using the ExportResponsesPopulated Method and populate an ExportResponsesFull object to get all the responses from a particular survey.

The finest grain of this object is "Question" and "Answer".
The Question is the "Code" field from the Survey Question object.

Do you know if there is any way to get the Question ID itself from the response object ?

One of our surveys was set up incorrectly and has the same Code for 2 questions.
e.g.
Question ID : 4031
Code : Big Black Bag
Group : Q24

Question ID : 18809
Code: Big Black Bag
Group : Q20

The problem comes when we try to link the Answer object
Question : Big Black Bag
Answer : Yes

We can't distinguish between the 2 possible questions it could be the answer to.
Is there any way you can think of to overcome this ? The data is already live and captured.

Thanks in advance !
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #190887 by holch
The code for a question can never be "Big Black Bag", because there are no spaces allowed in the question code, also Limesurvey will not allow two questions with the same question code. So there is something really strange going on in your survey, if you really have the question code "Big Black Bag" twice.

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.
  • Bromatello
  • Bromatello's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago #190888 by Bromatello
Sorry, I was just using that as an example.
The actual code is Audi.
And it is in there twice. I didn’t think it was possible either, as it auto generates a code usually.

So the question still remains, can I get the question id?
Any idea ?
Thanks
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #190889 by holch
As I said, there IS NO WAY Limesurvey will allow you to have the same question code twice. Also, the question code is NEVER autogenerated. So I fear we are talking about different things here.

Could you show a screenshot of one of these questions? Whenever I make the mistake to give a question the same code, it will give me an error message. So my guess is, you are not talking about the question code, but something else...

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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #190903 by tpartner
Where did you find the "ExportResponsesPopulated" method? I don't see that anywhere.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #190937 by DenisChenu

tpartner wrote: Where did you find the "ExportResponsesPopulated" method? I don't see that anywhere.

+1

Seems you use your own code , not published … then …

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.
  • Bromatello
  • Bromatello's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago #190957 by Bromatello
Hi ,

Thanks for all your replies so far, it's very kind of you to look for me.

Here's two screenshots attached. One is the Question codes in the lime survey application, and one is the responses returned from the API.
Basically, for several questions groups, the Code was "Audi". I've manually changed some to be Audi2, Audi3 etc, and the system has auto generated codes ( "r170q1", "r173q0", etc ) for questions that have the same name. This is when you import a file to add the options for a question.
As you can see, there are 2 codes called "Audi".
Now, this would be okay if I could retrieve the Question ID when I call the API.
But as you can see from the second image I uploaded, the API only returns the question code and the answer.
What I'd like to see is the Question ID, so I can tie it back to the original Question.

Does that make sense ?

Thanks in advance !
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #190960 by holch
How on earth did he get two identical question codes into one survey??

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.
  • Bromatello
  • Bromatello's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago #190961 by Bromatello
"How on earth did he get two identical question codes into one survey??"

I know !?!

I didn't set the survey up, I'm building an API to process the data pulled back from the LS API.
But that code is there and Live, so it can't be undone.

I can see the Question ID in the Lime Survey Application Database, but I'd prefer to get it from a proper API call.

thanks again !
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose