Popular Articles

  1. sgapiSort(%%array, %%flag)

    This is equivalent to the sort function in PHP. This function sorts an array. Elements will be arranged from lowest to highest when this function has completed. The %%flag parameter defaults to "SORT_REGULAR". See the PHP documentation to lea...
  2. Target a Specific Page With The Back Button

    In support we get asked if we can have the back button target a specific page. Though this is not a built-in feature, we do have a script for that! In our survey below if you hit the back button you will be sent to the Thank You Page.  Try it o...
  3. sgapiFullChop(%%string)

    This function runs both the PHP rtrim and ltrim functions on the given value and returns the results. This will remove all preceding and trailing whitespace. Example The below example will output the following: Text to Leftall this ...
  4. sgapiArray_Multisort(%%array1, %%array2)

    This function is equivalent to the array_multisort function in PHP. This function can be used to sort several arrays at once, or a multi-dimensional array by one or more dimensions. To see an example or learn more other PHP functions and ...
  5. sgapiTranslate(%%string,%%language)

    This function translates a string in custom scripting to the current language of the survey (or a language specified as the optional second parameter). The sgapiTranslate function creates a translation field for the specified string in the Tex...
  6. sgapiTablePDF(%%pdf, %%data, %%cols, %%title, %%options)

    This function adds a table to the given PDF. Parameters %%pdf - The title of the PDF you are creating. %%data = array() - The array of data to include in the table. %%cols= array() - The array of column headers. %%title - The table t...
  7. sgapiKSort(%%array, %%flag)

    This is equivalent to the  ksort  function in PHP. This function sorts an array by key. In this case, key is the answer option SKU. Elements will be arranged sequentially when this function has completed. The %%flag parameter defaults to "SORT_...
  8. sgapiPow(%%base,%%power)

    This is equivalent to the pow function in PHP. It returns the value of %%base raised to the power of %%power. To see an example or learn more other PHP functions and PHP programming, visit PHP Documentation . ...
  9. sgapiIsHttps()

    This function returns a boolean for whether or not the survey link is set to secure (https). Example In the below example we're running some piece of code if the link is secure. if (sgapiIsHttps() === true{ // code } ...
  10. sgapiPreg_Replace(%%pattern, %%replacement, %%subject, %%limit)

    This is equivalent to the preg_replace function in PHP. Searches %%subject for matches to %%pattern and replaces them with %%replacement. The optional %%limit parameter defaults to -1 (no limit). To see an example or learn more other PHP ...