SurveyGizmo's CustomScript Action now supports the LUA programming language.
Legacy Custom Scripting Language Deprecation Plans
New accounts (created after October 29, 2018) will only have the option to use Lua in scripts.
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.
In the long term, Legacy Custom Scripting Actions will be switched to read-only. Read-only scripts will continue to function; you will just be prevented from editing. The exact date on this is to be determined; we will send notifications well ahead of time.
While SurveyGizmo is one of the most flexible survey tools around, we get requests for customizations that are not available out of the box. This is where JavaScript and Custom Scripting can save the day. If you have scripting chops you can use the JavaScript action or the Custom Scripting action to achieve the survey of your dreams.
There isn't a built-in way to use the total of the Continuous Sum question in another question. This script will populate a hidden value with the total from a Continuous Sum so that you can use the total later on in your survey. These steps assume a basic familiarity with Alchemer and Custom Scripting.
Start by building all of your survey questions. In this example survey, we have a continuous sum question on the first page.
On the next page, we have a custom script action with the script below followed by a hidden value. This hidden value will be populated by the script. You can then use the merge code for the hidden value in later questions or text. In this case the merge code would be for question ID 5: [question("value"), id="5"].
contsum = 2 --Continuous Sum QuestionID
hiddenvalue = 5 --QuestionID of hidden value that will store total
contsum_data = getvalue(contsum)
finalval=0
for key,value in pairs(contsum_data) do
chars = {',','%','$','₠','₡','₢','₣','₤','₥','₦','₧','₨','₩','₪','₫','€','₭','₮','₯','₱','₲','₳','₴','₵','₶','₷','₸','₹'}
val = str_replace(chars, '', value)
finalval = finalval + val
end
setvalue(hiddenvalue,finalval)
Required Customizations
In the script above you will need to customize variables highlighted in yellow in order to make the script work in your survey.
contsum - This is the Continuous Sum questionID.
hiddenvalue - This is the Hidden Value question ID where you wish to store the total.