Welcome to the LimeSurvey Community Forum

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

API Assessement value

  • benjaminboldt
  • benjaminboldt's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 10 months ago #169759 by benjaminboldt
API Assessement value was created by benjaminboldt
Hello,

I was wondering which function of the LimeSurvey JSONRpc Api was able to give me the assessment value of a label set element ID.

I get the responses of a survey with `export_responses` but there's only the responses codes which is not really helpful. I tested a bunch of the API functions but can't find what I am looking for.

Thank you !
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169776 by holch
Replied by holch on topic API Assessement value
As the assessment values are not stored in the results database, I don't think you will be get them with the API.

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.
  • benjaminboldt
  • benjaminboldt's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 10 months ago #169778 by benjaminboldt
Replied by benjaminboldt on topic API Assessement value
Thanks for you answer.

So, from my understanding. There is no other way to weight answers than assessment values and there are not available with the API ? That's odd.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago - 5 years 10 months ago #169779 by holch
Replied by holch on topic API Assessement value
Well, I don't know 100% if they are not available with the API. However, I know that the results of the assessments are not stored in the database (which I personally find odd, but it has always been like this and there seems no effort to do so, especially with the Expression Manager allowing so much more flexible 'assessments' and storing data in the database via equation question). Let's see if someone with more knowledge about the functionalities of the API will come by and sheds a light.

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

Last edit: 5 years 10 months ago by holch.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169789 by tpartner
Replied by tpartner on topic API Assessement value
Either load the assessment value into a hidden equation question or create your own "score" with Expression Manager.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • benjaminboldt
  • benjaminboldt's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 10 months ago #169791 by benjaminboldt
Replied by benjaminboldt on topic API Assessement value
Thanks for your replies.

Actually, I knew I could store the overall assessment value score of a survey inside an hidden field. But, I need to get the assessment value for each question answer. If I had to store each question answer assessment value inside an hidden field for each question, I would double the number of questions I have to create. Which is not really nice since I certainly have to make the creation process easy for my client.

Well, guess I'll have to create label sets for each group of answers and store assessment values into label code.

Thanks anyway for your help !

Still open for another way to do it, if anybody has an other idea. :)
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169796 by holch
Replied by holch on topic API Assessement value
Yes, if you need every single assessment value of every answer option, you would have a lot of additional hidden equation questions to store.

If each answer option has different assessment values using the label code is certainly a quick solution. Now if answer options in the same question can have the same assessment value, then you won't be able to use this approach, as the answer codes need to be unique.

No other idea, but of course this all depends what you are actually trying to do. Without knowing the whole story, I currently don't see any other approach.

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.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169802 by DenisChenu
Replied by DenisChenu on topic API Assessement value
You mean using : api.limesurvey.org/classes/remotecontrol..._question_properties ?
If yes : good idea to have it :).

Else : you can create your own API function : extensions.sondages.pro/development-and-...d-remotecontrol-api/ :)

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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169809 by tpartner
Replied by tpartner on topic API Assessement value
The get_question_properties() method does return the assessment values.

Code:
<?php
 
  require_once 'jsonRPCClient.php';
 
  define( 'LS_BASEURL', 'http://pathTo/limeSurvey');  
  define( 'LS_USER', 'admin' );
  define( 'LS_PASSWORD', 'password' );
 
  $iQuestionID = 123;
 
 
  if(ctype_alnum($iQuestionID)) { // Valid QID format
 
    // Instantiate a new RPC client
    $myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );
 
    // Get a session key
    $sSessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
 
    if(is_array($sSessionKey)) { // Invalid session
      echo $sSessionKey['status'];
    }
    else if($sSessionKey) { // Valid session
 
      $questionProperties = $myJSONRPCClient->get_question_properties($sSessionKey,  $iQuestionID);
 
      foreach($questionProperties['answeroptions'] as $key => $value) {
        foreach($value as $key => $value) {
          echo $key . ' => ' . $value . '<br />';
        }
        echo '<br /><br />';
      }
    }
 
    // Release the session key
    $myJSONRPCClient->release_session_key( $sSessionKey );
  }
  else { // Invalid SID format
    die( 'Invalid format!' );
  }
 
?>


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, holch
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose