Piping from a Checkbox Question Into Multi-Slider

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.

Unfortunately the multi-sliders question does not have piping as a feature, but we can do this through a custom script as illustrated here.

For this to work the target question must be setup with slider option names which correspond to the option titles of the source questions, with automatic piping turned off.

Example survey (6th to 7th page): http://survey.alchemer.com/s3/2158470/Custom-Piping-Filtering

OR

Want to download this survey to your account so you can play with it? Just click here.

Estimated implementation and testing time: 5-10 minutes

This script uses the following custom scripting functions:

  • sgapiGetValue
  • sgapiGetQuestionOptions
  • sgapiIn_Array
  • sgapiRemoveOption
  • sgapiCount
  • sgapiJumpToPage

The Script

The script below requires for us to plugin the question id of the the source checkbox question, the id of the target multi-sliders question and the id of the next page to jump to if there are no sliders to show as a result of the filtering.

%%source_id = 22;
%%target_id = 53;
%%next_page_id = 2;

%%checkbox = sgapiGetValue(%%source_id);
%%multi_textbox = sgapiGetQuestionOptions(%%target_id);

%%hidden_options = 0;
foreach(%%multi_textbox as %%id => %%title){

   if(!(sgapiIn_Array(%%title, %%checkbox))){

      sgapiRemoveOption(%%target_id,%%title);
      %%hidden_options += 1;
   }

}

if(sgapiCount(%%multi_textbox) == %%hidden_options){

   sgapiJumpToPage(%%next_page_id);

}

In the script above you will need to customize variables highlighted in yellow in order to make the script work the way you'd like.

Required Customizations

%%source_id - This variable will indicate the question ID of the source Checkbox question.

%%target_id - This variable will indicate the question ID of the target Multi-sliders question.

%%next_page_id - The page to jump to if no options are selected in the checkbox question which correspond to the option titles of each of the multi-slider options.

Scripting and Other Custom Solutions

We’re always happy to help you debug any documented script that is used as is. That said, we do not have the resources to write scripts on demand or to debug a customized script.

If you have customization ideas that you haven't figured out how to tackle, we're happy to be a sounding board for alchemer features and functionality ideas that might meet your customization. Beyond this, you might want to consult with someone on our professional Services Team; these folks might have the scripting chops to help you to achieve what you are looking for!