Welcome to the LimeSurvey Community Forum

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

Get responses and all token attributes using remotecontrol 2 api

  • jsibley
  • jsibley's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #153050 by jsibley
Is there a way to get all token attributes together with responses using the remotecontrol api, without having to specify each attribute (I have a lot of them)?

I've looked at the documentation, but how to do this still isn't clear to me.

Thanks.
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
6 years 10 months ago #153055 by tammo
My great "teacher" (Frans Marcelissen) showed me this (using R):

library(limer)
options(stringsAsfactors=FALSE)

LSURL<-[your url to limesurvey api]
LSUSER=[your-user]
LSPASSWORD=[your-password]

options(lime_api = LSURL)
options(lime_username = LSUSER)
options(lime_password = LSPASSWORD)
get_session_key()

sid<-[your sid]
call_limer("list_participants", list(sid,0,999999,F))

all_attributes<- c('id',
'completed',
'participant_id',
'language string',
'usesleft',
'firstname',
'lastname',
'email',
'blacklisted',
'validfrom',
'sent',
'validuntil',
'remindersent',
'mpid',
'emailstatus',
'remindercount',
paste0('attribute_',1:100)
)

call_limer("list_participants", list(sid,0,999999,F, all_attributes))

Maybe this helps. I do not have any experience with other languages.


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The following user(s) said Thank You: Ben_V
The topic has been locked.
  • jsibley
  • jsibley's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #153097 by jsibley
I look forward to trying this out. As it happens, I'm using r.

Perhaps the only or best way is to specify each attribute, but you showed a nice shortcut I hadn't thought of.

Thanks.
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
6 years 10 months ago #153099 by tammo
With me, this works.

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
  • jsibley
  • jsibley's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #153105 by jsibley
Hi,

Testing this out, it appears that call_limer("list participants"...) returns a data frame that includes another data frame called "participant info". Is that your experience?

This creates a problem for me, as I can't include that data frame and use "filter" in r without getting an error. Might you have a solution for this?

Thanks!
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
6 years 10 months ago #153110 by tammo
survey_tokens<-call_limer("list_participants", list(survey_list$sid,0,999999,F, all_attributes))

# Clean up token table, because it has a nested dataframe for participant_info
survey_tokens<-cbind(survey_tokens$participant_info, survey_tokens[-c(3)])

This did the trick with me.

Happy R-ing!

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose