[Solved] Get sku of “other write in option” in radio button grid

0

I am using custom scripting to set default answers.

I can locate the skus of radio button grid rows using the code below:

//////////////////////////////////////////////////////

// create array of qids of rows in radio button grid
// VQ: Visitation Question
%%qid = 56;
%%VQ = sgapiGetTableQuestionSkus(%%qid);

%%output .= sgapiPrint_R(%%VQ);

foreach (%%VQ as %%j) {
sgapiSetValue(%%j,”5″); // set default value
}

////////////////////////////////////////////////////

However,¬†sgapiGetTableQuestionSkus does not return the sku of the “write-in” row of the radio button grid.

How do I learn the sku of the write-in row of a radio button grid?

Thanks

 

richard halle asked

    Best answer

    0

    Hi Richard!

    “Other” rows in a grid question are created dynamically at survey runtime, and so these rows do not have a static SKU they are assigned. This is related to how the data is processed and stored on SurveyGizmo back-end servers; I apologize for the inconvenience caused by this “leaky abstraction”!

    I am not certain of the reliability of this method, but I was able to find a way to get the SKU for an “Other” row. To do this, first load your survey (either in Preview, Test, or as a real session), and then use your browser developer tools to view the DOM of your grid question. There will be a table row (tr) element in the DOM for each of your grid question’s rows, and there will be various classes and an ID referencing the SKU of these rows:

    The SKU for my “Other” row here is 10002, which can then be passed to functions like sgapiSetValue() and sgapiHideQuestion(), etc. Again, this is not documented in our software, and so I am uncertain if this SKU will ever change or not. If you happen to notice any patterns with this (does it work reliably for you, or do you find the SKU possibly changes for some reason?), please add a comment to this question!

    Thanks again for a great question, and I hope this helps!

    Nathan - Survey Astronaut answered
      ×

      Login

      Question stats

      • Active
      • Views1179 times
      • Answers1 answer
      • Followers0 followers