Report numeric answers as bandings


I send out a monthly survey to opticians.  One of the questions in the survey is “What do you charge for an eye exam?”.  At the moment I have it as a radio button question with bandings (up to £20/£21-£30/£31-£40 etc).  I think it is easier to present the results that way.
BUT, I have been asked if I can calculate the average cost of an eye exam, which I don’t think I can unless I have a numeric text box question asking the exact amount each respondent charges.
Is there a way that I can present my data both ways without asking the question twice – ie, have a numeric text box question but be able to group the answers into bands in the report if I want to?

Jim Wetherill answered

    There is no basic functionality within SurveyGizmo that can do this, but if you have a PRO or ENTERPRISE level account, you can do this with custom scripting.

    Your first step would be to create an ADMIN ONLY survey page after the “What do you charge…” question.  This page will contain the custom script and an ADMINISTRATIVE QUESTION.

    The custom script will look at the value that the respondent has entered for the “What do you charge…” question, establish a ‘band’ for it, and place that ‘band’ value as a response into the ADMIN ONLY question.  The respondents will not see that ‘band’ question, but it will be available to you in reporting.

    This script would make use of the sgapiGetValue and sgapiSetValue functions.  The following is a rough pseudo-code version of what the script would look like:

    //The question ID of the “What do you charge…” question is 25.
    The question ID of the admin-only ‘band’ question is 30.//

    xcharge = sgapiGetValue(25);

    if xcharge is greater than 0 but less than 2
         {sgapiSetValue(30, ‘0 to 1.99’};

    if xcharge is greater then or equal to 2 but less then 3
         {sgapiSetValue(30, ‘2 to 2.99};

    There might be a more elegant way to code the set value process, but my group tends to write really simple code.

    You are going to have to setup some kind of validation for the “What do you charge….” question so that all of the responses work with the custom script.

    It will probably take you several trials to get this to work correctly.  When we build this type of process usually set up a test survey with just the involved questions.  Once we have a custom script that works we copy it into the primary survey.

    Good luck.

    Jim Wetherill answered


      Question stats

      • Active
      • Views4863 times
      • Answers1 answer
      • Followers1 follower