- Posts: 67
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
RPC list_participants only returns part of the list
- aukevann
- Topic Author
- Offline
- Senior Member
Less
More
8 years 11 months ago #118530
by aukevann
RPC list_participants only returns part of the list was created by aukevann
Hi,
I am using the RPC 2 list_participants call to get a list of participants for a survey.
However, it only returns about 10 entries out of the Token Tables. Only with small Token Tables (10 or less participants) it returns all.
Is there a limit set to the size of the RPC request?
If so, where can I make them bigger?
Any help appreciates,
Regards,
Auke
I am using the RPC 2 list_participants call to get a list of participants for a survey.
However, it only returns about 10 entries out of the Token Tables. Only with small Token Tables (10 or less participants) it returns all.
Is there a limit set to the size of the RPC request?
If so, where can I make them bigger?
Any help appreciates,
Regards,
Auke
The topic has been locked.
- SashaNS
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
7 years 4 months ago #144393
by SashaNS
Replied by SashaNS on topic RPC list_participants only returns part of the list
Hi Auke,
I have encountered exactly the same problem. Did you (or anybody else) find a solutions to this?
I actually always need the last participant in the table, but the number is changing so I can't use iStart and iLimit parameters.
I am using the Remote Control 2 API with R (version 3.3.1) on Windows 7.
Thank you!
Sasha
I have encountered exactly the same problem. Did you (or anybody else) find a solutions to this?
I actually always need the last participant in the table, but the number is changing so I can't use iStart and iLimit parameters.
I am using the Remote Control 2 API with R (version 3.3.1) on Windows 7.
Thank you!
Sasha
The topic has been locked.
- aukevann
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 67
- Thank you received: 2
7 years 4 months ago #144394
by aukevann
Replied by aukevann on topic RPC list_participants only returns part of the list
Hi Sasha,
No, nobody seems to be active to with solving these issues on the API and I can't code for LS.
So eventually I build a workaround, reading in the database tables directly.
Good luck
Auke
No, nobody seems to be active to with solving these issues on the API and I can't code for LS.
So eventually I build a workaround, reading in the database tables directly.
Good luck
Auke
The following user(s) said Thank You: SashaNS
The topic has been locked.
- LouisGac
- Visitor
7 years 4 months ago #144421
by LouisGac
Replied by LouisGac on topic RPC list_participants only returns part of the list
github.com/LimeSurvey/LimeSurvey/blob/ma...rol_handle.php#L1816
So just set the limit to what you need.
If you need no limit at all, we could update the code.
Code:
list_participants($sSessionKey, $iSurveyID, $iStart=0, $iLimit=10, $bUnused=false, $aAttributes=false, $aConditions=array() )
So just set the limit to what you need.
If you need no limit at all, we could update the code.
The topic has been locked.
- SashaNS
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
7 years 4 months ago #144424
by SashaNS
Replied by SashaNS on topic RPC list_participants only returns part of the list
Hi LouisGac, thanks for the reply.
Since I need always the last token in the table I did the following:
I used the get_summary method to get the token count (which in R looks like this):
I call the list_participants method with iLimit = token_count(survey.id)-1 to get the last participant in the table.
This works for me, but this still doesn't solve the root of the problem, which was the fact that list_participants gives you only 10 responses. Would the method work if you remove the default value for $iLimit, or is there a way to make the default value the number of rows/entries in the participants table? I believe the method would be much useful that way.
Cheers,
Sasha
Since I need always the last token in the table I did the following:
I used the get_summary method to get the token count (which in R looks like this):
Code:
token_count <- function(survey.id){ res <- call_limer(method = "get_summary", params = list(iSurveyID = survey.id, sStatName = "token_count")); res }
Code:
call_limer(method = "list_participants", params = list(iSurveyID = survey.id, iLimit = as.integer(token_count(survey.id))-1))
This works for me, but this still doesn't solve the root of the problem, which was the fact that list_participants gives you only 10 responses. Would the method work if you remove the default value for $iLimit, or is there a way to make the default value the number of rows/entries in the participants table? I believe the method would be much useful that way.
Cheers,
Sasha
The topic has been locked.
- LouisGac
- Visitor
7 years 4 months ago #144425
by LouisGac
Replied by LouisGac on topic RPC list_participants only returns part of the list
I'm not using R my self, and I never used the RPC. But here my bet: in the code you provided, you're setting the iStart parameter, not the limit one.
To get the last 100 ones, try something like:
To get the last 100 ones, try something like:
Code:
call_limer(method = "list_participants", params = list(iSurveyID = survey.id, iStart = as.integer(token_count(survey.id))-100),iLimit=100 )
The topic has been locked.
- SashaNS
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
7 years 4 months ago #144428
by SashaNS
Replied by SashaNS on topic RPC list_participants only returns part of the list
Sure, yes, silly me. I meant iStart.
I am sure that would work what you are suggesting. Also I could have used the token_count to set iLimit, and to get all responses.
I am sure that would work what you are suggesting. Also I could have used the token_count to set iLimit, and to get all responses.
The topic has been locked.