[Solved] custom script in report

0

Hi,

I have create a custom script and it works in survey. I would like to have the result into report…how can I do it?

Thanks

Donatella Fiorentino asked

    Best answer

    0

    Hi Donatella!

    To record data that you have generated with a Custom Script action, you will want to use the sgapiSetValue() function. This function allows you to set the value of a field, whether that’s a Textbox question or Hidden Value action.

    Once you have stored your data in a field, it will then be available for reporting and exporting.

    To learn more about this function and see a few examples of its use, check out the tutorial below :)

    http://script.surveygizmo.com/help/article/link/sgapisetvalue

    I hope this helps to answer your question!

    Nathan - Survey Astronaut answered
      0

      Thank you Nathan!

      But your solution requires me to manually enter the result into the script.
      But I used the script “sgapiResultsQuestionAverage” to calculate the mean and I would like to see this result in the report.

      Donatella Fiorentino answered
        • Hey Donatella :) I might recommend an introduction course to PHP to help bridge this gap for you:

          https://www.codecademy.com/learn/php

          What you’re looking to do is fairly straightforward, once you have a basic grasp of variables in PHP (which the SurveyGizmo Custom Scripting language is based upon). Something like this:

          %%result = sgapiResultsQuestionAverage(%%questionYouWantTheAverageOf);
          sgapiSetValue(%%hiddenField, %%result);

        0

        Thanks for your reply!!

        However I don’t know how insert a custom script into an hidden value…

        Someone has already done it?

         

        Donatella Fiorentino answered
          1

          Reports provide data for survey questions or hidden elements. The best option to have the script result in a report is likely to output the result of your script into a question or hidden value so that it is stored as an answer on the survey.

          Hope that at least points you in the right direction.

          Dominic Sharpe answered
            ×

            Login

            Question stats

            • Active
            • Views3300 times
            • Answers4 answers
            • Followers0 followers