sgapiSetCustomTableValue(%%qID, %%rowname, %%value)

Important Update to Custom Scripting

SurveyGizmo's CustomScript Action now supports the LUA programming language. Visit our NEW Lua Scripting Resources!

Legacy Custom Scripting Language Deprecation Plans 

  1. New accounts (created after October 29, 2018) will only have the option to use Lua in scripts.
  2. As of October 29, 2018 Custom Scripting Actions will default to Lua as the scripting type in the Custom Scripting Action for accounts created before this date. You will be able to switch to the Legacy Custom Scripting; though we highly encourage using Lua.
  3. In the long term, Legacy Custom Scripting Actions will be switched to read-only. The exact date on this is to be determined; we will send notifications well ahead of time.

This function allows you to set the value for an individual cell in a custom table question.


The custom table has two rows and two column questions (one radio button and one textbox). In this example, we will pre-populate the radio button question with the answer "No" using sgapiSetCustomTableValue

The custom table questionID is 2, however each column has its own ID as well. We'll need to pull these IDs in order to set specific rows. To do so, we'll add a custom script action before the custom table question on the page and paste the below code. This will pull the IDs for the columns of our custom table.

%%sub_IDs = sgapiGetTableQuestionSkus(2);
%%output = sgapiPrint_R(%%sub_IDs);

Next, we'll preview the page with the script and the custom question. The below array will be output. This indicates that our first column Radio has an ID of 3 and the second column Textbox has an ID of 4.

Array([0] => 3 [1] => 4)

Now that we have our column IDs, were going to go back to our custom script action and delete the code to optain our table question skus and replace with the below.

%%value = 'No'; //The reporting value of the option we're prepopulating

sgapiSetCustomTableValue(3,'Row 1',%%value); 
  • 3 is the Radio column ID.
  • Row 1 is the row of the column we're prepopulating.
  • %%value is the reporting value for the option we'd like to preselect.

Our prepopulated custom table looks like so: