- Posts: 40
- Thank you received: 0
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
- Topic Author
- Offline
- Senior Member
Less
More
6 years 10 months ago #153050
by jsibley
Get responses and all token attributes using remotecontrol 2 api was created 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.
I've looked at the documentation, but how to do this still isn't clear to me.
Thanks.
The topic has been locked.
- tammo
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 962
- Thank you received: 216
6 years 10 months ago #153055
by tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Replied by tammo on topic Get responses and all token attributes using remotecontrol 2 api
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.
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
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 40
- Thank you received: 0
6 years 10 months ago #153097
by jsibley
Replied by jsibley on topic Get responses and all token attributes using remotecontrol 2 api
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.
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
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 962
- Thank you received: 216
6 years 10 months ago #153099
by tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Replied by tammo on topic Get responses and all token attributes using remotecontrol 2 api
With me, this works.
Tammo
Tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
- jsibley
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 40
- Thank you received: 0
6 years 10 months ago #153105
by jsibley
Replied by jsibley on topic Get responses and all token attributes using remotecontrol 2 api
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!
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
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 962
- Thank you received: 216
6 years 10 months ago #153110
by tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Replied by tammo on topic Get responses and all token attributes using remotecontrol 2 api
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
# 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.