sgapiSetTableOrderByTable(%%tableID,%%refID,%%language)

Important Update to Custom Scripting

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


  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 accepts two table Question IDs and orders the rows of the table in %%tableID by the table in %%refID. This allows you to maintain randomization order across tables in your survey. The row headers for both tables must be identical.

Parameters

  • %%tableID - The ID of the table you would like to apply randomization to
  • %%refID - The ID of the table whose randomization you'd like to reference
  • %%language - This parameter is only necessary in multi-language surveys. Because the script is matching on row header you'll need to run the script for each language. The syntax is like so: %%language="English"

Example

This example script randomizes table ID 12 in the same order as reference table ID 3. The rows for table ID 3 are set up to be randomized within the application.

Check it out in an Example Survey

%%table = 12;
%%reftable = 3;

sgapiSetTableOrderByTable(%%table,%%reftable);